diff --git a/CHANGELOG.md b/CHANGELOG.md index d3650a2..ea32ec7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,41 @@ All notable changes to the Codacy.Api project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## Unreleased + +### Added +- Webhook endpoint management on `IOrganizationsApi`: `ListWebhookEndpointsAsync`, + `CreateWebhookEndpointAsync` and `DeleteWebhookEndpointAsync`. The create response carries the + signing secret, which Codacy returns only once. +- `CodacyWebhook` for receivers: `VerifySignature` checks the `X-Codacy-Signature` + (`sha256=`) HMAC-SHA256 of the raw body in constant time, and `Deserialize` reads the + `quality.analysis.completed` payload into `WebhookAnalysisCompleted`. + +- Every other non-deprecated operation in the official specification that the client lacked, + about 170 in all, in 23 new API modules on `ICodacyClient`: `Sbom`, `Images`, `Reports`, + `AiInventory`, `Billing`, `OrganizationSettings`, `Enterprises`, `Admin`, `Platform`, + `RepositorySettings`, `RepositoryApiTokens`, `RepositoryFiles`, `RepositoryCoverageReports`, + `Diffs`, `GatePolicies`, `Segments`, `Jira`, `Slack`, `Dast`, `RepositoryToolPatterns`, + `AnalysisActions`, `Tools` and `Metrics`. These were written from the specification and have + not been exercised against the live API. +- Methods that return a CSV report (`IReportsApi`) return a `Stream` the caller must dispose. + +### Fixed +- `SearchRepositoryIgnoredIssuesAsync` and `SyncOrganizationNameAsync` called paths that are + not in the official Codacy specification. They now use `.../ignoredIssues/search` and + `.../settings/sync`. + +### Deprecated +- The `repositories` query parameter on `ListOrganizationRepositoriesWithAnalysisAsync` and + `ListOrganizationPullRequestsAsync`, which Codacy has deprecated. Use + `SearchOrganizationRepositoriesWithAnalysisAsync`. C# cannot mark a parameter `[Obsolete]`, + so this is stated in the XML documentation. +- `CleanCacheAsync`: Codacy has removed `cache/clean` from its API. + +### Changed +- `swagger.yaml` is now the official specification from `api.codacy.com` (still v3.1.0, but + about 3,000 lines longer than the copy it replaces). + ## 4.0.0 ### Fixed diff --git a/Codacy.Api.Test/Models/WebhookTests.cs b/Codacy.Api.Test/Models/WebhookTests.cs new file mode 100644 index 0000000..b326677 --- /dev/null +++ b/Codacy.Api.Test/Models/WebhookTests.cs @@ -0,0 +1,117 @@ +using System.Security.Cryptography; +using System.Text; +using System.Text.Json; + +namespace Codacy.Api.Test.Models; + +/// +/// Tests for the webhook models and the delivery verifier, using bodies taken from the Codacy +/// webhook documentation and API reference. +/// +public class WebhookTests +{ + private static JsonSerializerOptions Options => CodacyClient.JsonSerializerOptions; + + private const string PullRequestBody = """ + { + "event": "quality.analysis.completed", + "repository": { "name": "engine" }, + "organization": { "id": 123456 }, + "target": { "type": "pullRequest", "value": "464" }, + "commitSha": "a1b2c3d4e5f60718293a4b5c6d7e8f9012345678", + "status": "partial_success", + "timestamp": "2025-09-17T23:00:00Z" + } + """; + + private static string Sign(string body, string secret) => + "sha256=" + Convert.ToHexStringLower(HMACSHA256.HashData(Encoding.UTF8.GetBytes(secret), Encoding.UTF8.GetBytes(body))); + + [Fact] + public void Deserialize_PullRequestDelivery_ReadsEveryField() + { + var payload = CodacyWebhook.Deserialize(PullRequestBody); + + payload.Event.Should().Be(CodacyWebhook.AnalysisCompletedEvent); + payload.Repository.Name.Should().Be("engine"); + payload.Organization.Id.Should().Be(123456); + payload.Target.Type.Should().Be(WebhookTargetType.PullRequest); + payload.Target.Value.Should().Be("464"); + payload.CommitSha.Should().Be("a1b2c3d4e5f60718293a4b5c6d7e8f9012345678"); + payload.Status.Should().Be(WebhookAnalysisStatus.PartialSuccess); + payload.Timestamp.Should().Be(DateTimeOffset.Parse("2025-09-17T23:00:00Z", CultureInfo.InvariantCulture)); + } + + [Theory] + [InlineData("success", WebhookAnalysisStatus.Success)] + [InlineData("failure", WebhookAnalysisStatus.Failure)] + public void Deserialize_BranchDelivery_ReadsStatusAndTarget(string status, WebhookAnalysisStatus expected) + { + var body = PullRequestBody + .Replace("partial_success", status, StringComparison.Ordinal) + .Replace("pullRequest", "branch", StringComparison.Ordinal); + + var payload = CodacyWebhook.Deserialize(body); + + payload.Status.Should().Be(expected); + payload.Target.Type.Should().Be(WebhookTargetType.Branch); + } + + [Fact] + public void WebhookEndpointCreated_ReadsSecret() + { + const string json = """ + { + "id": "80f64371-e6bc-4d9b-b022-7c873cc5e39f", + "url": "https://example.com/webhooks/codacy", + "createdAt": "2020-11-09T09:10:00Z", + "secret": "3n8fVhZ2k9m1QpXeYtR7wLdCsUbGjNoA" + } + """; + + var created = JsonSerializer.Deserialize(json, Options)!; + + created.Id.Should().Be(Guid.Parse("80f64371-e6bc-4d9b-b022-7c873cc5e39f")); + created.Url.Should().Be("https://example.com/webhooks/codacy"); + created.Secret.Should().Be("3n8fVhZ2k9m1QpXeYtR7wLdCsUbGjNoA"); + } + + [Fact] + public void WebhookEndpointList_ReadsCountAndLimit() + { + const string json = """ + { + "data": [ { "id": "80f64371-e6bc-4d9b-b022-7c873cc5e39f", "url": "https://example.com/webhooks/codacy", "createdAt": "2020-11-09T09:10:00Z" } ], + "count": 2, + "limit": 10 + } + """; + + var list = JsonSerializer.Deserialize(json, Options)!; + + list.Data.Should().ContainSingle(); + list.Count.Should().Be(2); + list.Limit.Should().Be(10); + } + + [Fact] + public void VerifySignature_ValidSignature_ReturnsTrue() => + CodacyWebhook.VerifySignature(PullRequestBody, Sign(PullRequestBody, "s3cret"), "s3cret").Should().BeTrue(); + + [Fact] + public void VerifySignature_TamperedBody_ReturnsFalse() => + CodacyWebhook.VerifySignature(PullRequestBody + " ", Sign(PullRequestBody, "s3cret"), "s3cret").Should().BeFalse(); + + [Fact] + public void VerifySignature_WrongSecret_ReturnsFalse() => + CodacyWebhook.VerifySignature(PullRequestBody, Sign(PullRequestBody, "other"), "s3cret").Should().BeFalse(); + + [Theory] + [InlineData(null)] + [InlineData("")] + [InlineData("deadbeef")] + [InlineData("sha256=not-hex")] + [InlineData("sha256=")] + public void VerifySignature_MissingOrMalformedHeader_ReturnsFalse(string? header) => + CodacyWebhook.VerifySignature(PullRequestBody, header, "s3cret").Should().BeFalse(); +} diff --git a/Codacy.Api/CodacyClient.cs b/Codacy.Api/CodacyClient.cs index d3fc93c..5376a21 100644 --- a/Codacy.Api/CodacyClient.cs +++ b/Codacy.Api/CodacyClient.cs @@ -1,4 +1,4 @@ -using System.Text.Json; +using System.Text.Json; using System.Text.Json.Serialization; using Codacy.Api.Interfaces; using Refit; @@ -64,6 +64,29 @@ public CodacyClient(CodacyClientOptions options) Coverage = CreateApiClient(); CodingStandards = CreateApiClient(); Security = CreateApiClient(); + Sbom = CreateApiClient(); + Images = CreateApiClient(); + Reports = CreateApiClient(); + AiInventory = CreateApiClient(); + Billing = CreateApiClient(); + OrganizationSettings = CreateApiClient(); + Enterprises = CreateApiClient(); + Admin = CreateApiClient(); + Platform = CreateApiClient(); + RepositorySettings = CreateApiClient(); + RepositoryApiTokens = CreateApiClient(); + RepositoryFiles = CreateApiClient(); + Diffs = CreateApiClient(); + RepositoryCoverageReports = CreateApiClient(); + GatePolicies = CreateApiClient(); + Segments = CreateApiClient(); + Jira = CreateApiClient(); + Slack = CreateApiClient(); + Dast = CreateApiClient(); + RepositoryToolPatterns = CreateApiClient(); + AnalysisActions = CreateApiClient(); + Tools = CreateApiClient(); + Metrics = CreateApiClient(); } /// @@ -126,6 +149,121 @@ public CodacyClient(CodacyClientOptions options) /// public ISecurityApi Security { get; } + /// + /// Gets the Sbom API module + /// + public ISbomApi Sbom { get; } + + /// + /// Gets the Images API module + /// + public IImagesApi Images { get; } + + /// + /// Gets the Reports API module + /// + public IReportsApi Reports { get; } + + /// + /// Gets the AiInventory API module + /// + public IAiInventoryApi AiInventory { get; } + + /// + /// Gets the Billing API module + /// + public IBillingApi Billing { get; } + + /// + /// Gets the OrganizationSettings API module + /// + public IOrganizationSettingsApi OrganizationSettings { get; } + + /// + /// Gets the Enterprises API module + /// + public IEnterprisesApi Enterprises { get; } + + /// + /// Gets the Admin API module + /// + public IAdminApi Admin { get; } + + /// + /// Gets the Platform API module + /// + public IPlatformApi Platform { get; } + + /// + /// Gets the RepositorySettings API module + /// + public IRepositorySettingsApi RepositorySettings { get; } + + /// + /// Gets the RepositoryApiTokens API module + /// + public IRepositoryApiTokensApi RepositoryApiTokens { get; } + + /// + /// Gets the RepositoryFiles API module + /// + public IRepositoryFilesApi RepositoryFiles { get; } + + /// + /// Gets the Diffs API module + /// + public IDiffsApi Diffs { get; } + + /// + /// Gets the RepositoryCoverageReports API module + /// + public IRepositoryCoverageReportsApi RepositoryCoverageReports { get; } + + /// + /// Gets the GatePolicies API module + /// + public IGatePoliciesApi GatePolicies { get; } + + /// + /// Gets the Segments API module + /// + public ISegmentsApi Segments { get; } + + /// + /// Gets the Jira API module + /// + public IJiraApi Jira { get; } + + /// + /// Gets the Slack API module + /// + public ISlackApi Slack { get; } + + /// + /// Gets the Dast API module + /// + public IDastApi Dast { get; } + + /// + /// Gets the RepositoryToolPatterns API module + /// + public IRepositoryToolPatternsApi RepositoryToolPatterns { get; } + + /// + /// Gets the AnalysisActions API module + /// + public IAnalysisActionsApi AnalysisActions { get; } + + /// + /// Gets the Tools API module + /// + public IToolsApi Tools { get; } + + /// + /// Gets the Metrics API module + /// + public IMetricsApi Metrics { get; } + /// /// Creates an API client using Refit /// diff --git a/Codacy.Api/CodacyWebhook.cs b/Codacy.Api/CodacyWebhook.cs new file mode 100644 index 0000000..dee7785 --- /dev/null +++ b/Codacy.Api/CodacyWebhook.cs @@ -0,0 +1,76 @@ +using System.Security.Cryptography; +using System.Text; +using System.Text.Json; +using Codacy.Api.Models; + +namespace Codacy.Api; + +/// +/// Helpers for receiving Codacy webhook deliveries: verifying the signature and reading the +/// payload. Codacy signs the raw request body with the secret returned when the endpoint was +/// created, so verify the bytes exactly as received, before any re-serialization. +/// +public static class CodacyWebhook +{ + /// Name of the header carrying the signature, sha256=<hex> + public static string SignatureHeader { get; } = "X-Codacy-Signature"; + + /// Name of the header carrying a unique identifier per delivery attempt + public static string DeliveryHeader { get; } = "X-Codacy-Delivery"; + + /// The only event Codacy currently sends + public static string AnalysisCompletedEvent { get; } = "quality.analysis.completed"; + + private const string SignaturePrefix = "sha256="; + + /// + /// Verifies a delivery's signature in constant time + /// + /// The raw request body, exactly as received + /// The value of ; null or malformed values fail verification + /// The endpoint secret from + /// True if the signature matches + public static bool VerifySignature(ReadOnlySpan body, string? signatureHeader, string secret) + { + ArgumentException.ThrowIfNullOrEmpty(secret); + + if (signatureHeader is null + || !signatureHeader.StartsWith(SignaturePrefix, StringComparison.OrdinalIgnoreCase)) + { + return false; + } + + byte[] provided; + try + { + provided = Convert.FromHexString(signatureHeader.AsSpan(SignaturePrefix.Length)); + } + catch (FormatException) + { + return false; + } + + var expected = HMACSHA256.HashData(Encoding.UTF8.GetBytes(secret), body); + return CryptographicOperations.FixedTimeEquals(expected, provided); + } + + /// + /// Verifies a delivery's signature in constant time + /// + /// The raw request body, exactly as received + /// The value of + /// The endpoint secret from + /// True if the signature matches + public static bool VerifySignature(string body, string? signatureHeader, string secret) + => VerifySignature(Encoding.UTF8.GetBytes(body), signatureHeader, secret); + + /// + /// Reads a quality.analysis.completed delivery body + /// + /// The request body + /// The payload + /// The body is not a valid payload + public static WebhookAnalysisCompleted Deserialize(string body) + => JsonSerializer.Deserialize(body, CodacyClient.JsonSerializerOptions) + ?? throw new JsonException("The webhook body was null."); +} diff --git a/Codacy.Api/Interfaces/IAdminApi.cs b/Codacy.Api/Interfaces/IAdminApi.cs new file mode 100644 index 0000000..8bc13f0 --- /dev/null +++ b/Codacy.Api/Interfaces/IAdminApi.cs @@ -0,0 +1,78 @@ +using System.Text.Json; +using Codacy.Api.Models; +using Refit; + +namespace Codacy.Api.Interfaces; + +/// +/// Interface for Codacy admin API operations (Codacy admins only) +/// +public interface IAdminApi +{ + /// + /// Search for an entity like Organization or Repository, supports ids and names + /// + [Get("/api/v3/admin")] + Task AdminSearchAsync( + [Query] string? search, + CancellationToken cancellationToken); + + /// + /// Returns the requested admin entity + /// + [Get("/api/v3/admin/{adminEntityGroupSlug}/{adminEntityIdentifier}")] + Task GetAdminEntityAsync( + string adminEntityGroupSlug, + long adminEntityIdentifier, + CancellationToken cancellationToken); + + /// + /// Returns the requested resources of a given admin entity + /// + [Get("/api/v3/admin/{adminEntityGroupSlug}/{adminEntityIdentifier}/{adminResourceSlug}")] + Task> ListAdminEntityResourcesAsync( + string adminEntityGroupSlug, + long adminEntityIdentifier, + string adminResourceSlug, + [Query] string? cursor, + [Query] int? limit, + CancellationToken cancellationToken); + + /// + /// Executes an action on a given admin entity; the payload fields match the action metadata + /// + [Post("/api/v3/admin/{adminEntityGroupSlug}/{adminEntityIdentifier}/actions/{adminActionSlug}")] + Task ExecuteAdminActionAsync( + string adminEntityGroupSlug, + long adminEntityIdentifier, + string adminActionSlug, + [Body] Dictionary payload, + CancellationToken cancellationToken); + + /// + /// Generates a license for self-hosted instances of Codacy + /// + [Post("/api/v3/admin/license")] + Task GenerateLicenseAsync( + [Body] License body, + CancellationToken cancellationToken); + + /// + /// Delete Codacy users based on a CSV file exported by GitHub Enterprise (sent as plain text) + /// + [Delete("/api/v3/admin/dormantAccounts")] + Task DeleteDormantAccountsAsync( + [Body] string csv, + CancellationToken cancellationToken); + + /// + /// Upload pen test reports for an organization (the provider is the provider code, for example gh) + /// + [Multipart] + [Post("/api/v3/admin/security/penTest/reports")] + Task UploadPenTestReportAsync( + [AliasAs("csvdata")] StreamPart csvData, + [AliasAs("provider")] string provider, + [AliasAs("organizationName")] string organizationName, + CancellationToken cancellationToken); +} diff --git a/Codacy.Api/Interfaces/IAiInventoryApi.cs b/Codacy.Api/Interfaces/IAiInventoryApi.cs new file mode 100644 index 0000000..90772f8 --- /dev/null +++ b/Codacy.Api/Interfaces/IAiInventoryApi.cs @@ -0,0 +1,80 @@ +using Codacy.Api.Models; +using Refit; + +namespace Codacy.Api.Interfaces; + +/// +/// Interface for AI inventory API operations (experimental upstream) +/// +public interface IAiInventoryApi +{ + /// + /// List AI inventory provider summaries for an organization + /// + [Post("/api/v3/organizations/{provider}/{organizationName}/ai-inventory/providers/summaries/search")] + Task> SearchAiInventoryProviderSummariesAsync( + Provider provider, + string organizationName, + [Body] AiInventoryFilter body, + [Query] string? cursor, + [Query] int? limit, + CancellationToken cancellationToken); + + /// + /// Get the AI inventory summary for a specific provider + /// + [Post("/api/v3/organizations/{provider}/{organizationName}/ai-inventory/providers/summary")] + Task GetAiInventoryProviderSummaryAsync( + Provider provider, + string organizationName, + [Body] GetAiInventoryProviderSummaryBody body, + CancellationToken cancellationToken); + + /// + /// List AI inventory marker summaries for an organization + /// + [Post("/api/v3/organizations/{provider}/{organizationName}/ai-inventory/markers/summaries/search")] + Task> SearchAiInventoryMarkerSummariesAsync( + Provider provider, + string organizationName, + [Body] AiInventoryFilter body, + [Query] string? cursor, + [Query] int? limit, + CancellationToken cancellationToken); + + /// + /// List repositories that have AI inventory items + /// + [Post("/api/v3/organizations/{provider}/{organizationName}/ai-inventory/repositories/search")] + Task> SearchAiInventoryRepositoriesAsync( + Provider provider, + string organizationName, + [Body] AiInventoryFilter body, + [Query] string? cursor, + [Query] int? limit, + CancellationToken cancellationToken); + + /// + /// List AI inventory repository summaries for an organization + /// + [Post("/api/v3/organizations/{provider}/{organizationName}/ai-inventory/repositories/summaries/search")] + Task> SearchAiInventoryRepositorySummariesAsync( + Provider provider, + string organizationName, + [Body] AiInventoryFilter body, + [Query] string? cursor, + [Query] int? limit, + CancellationToken cancellationToken); + + /// + /// List AI inventory location summaries for an organization + /// + [Post("/api/v3/organizations/{provider}/{organizationName}/ai-inventory/locations/summaries/search")] + Task> SearchAiInventoryLocationSummariesAsync( + Provider provider, + string organizationName, + [Body] AiInventoryFilter body, + [Query] string? cursor, + [Query] int? limit, + CancellationToken cancellationToken); +} diff --git a/Codacy.Api/Interfaces/IAnalysisActionsApi.cs b/Codacy.Api/Interfaces/IAnalysisActionsApi.cs new file mode 100644 index 0000000..3b93d3f --- /dev/null +++ b/Codacy.Api/Interfaces/IAnalysisActionsApi.cs @@ -0,0 +1,169 @@ +using Codacy.Api.Models; +using Refit; + +namespace Codacy.Api.Interfaces; + +/// +/// Interface for analysis action API operations (recovery, autoconfig, reanalysis, AI review, quick fixes) +/// +public interface IAnalysisActionsApi +{ + /// + /// Recover a stuck repository + /// + /// + /// Triggers a recovery action when the repository is stuck on its first analysis. + /// Codacy returns 422 when the repository is not stuck. + /// + [Post("/api/v3/analysis/organizations/{provider}/{organizationName}/repositories/{repositoryName}/recover")] + Task RecoverRepositoryAsync( + Provider provider, + string organizationName, + string repositoryName, + [Query] string? branch, + CancellationToken cancellationToken); + + /// + /// Add a repository autoconfiguration run + /// + /// + /// Experimental autoconfig enqueuing endpoint. + /// + [Post("/api/v3/analysis/organizations/{provider}/{organizationName}/repositories/{repositoryName}/autoconfig")] + Task AddAutoconfigAsync( + Provider provider, + string organizationName, + string repositoryName, + CancellationToken cancellationToken); + + /// + /// Get the latest autoconfig run summary + /// + [Get("/api/v3/analysis/organizations/{provider}/{organizationName}/repositories/{repositoryName}/autoconfig/runs")] + Task GetLatestAutoconfigRunSummaryAsync( + Provider provider, + string organizationName, + string repositoryName, + CancellationToken cancellationToken); + + /// + /// Get the autoconfig run status + /// + /// + /// Experimental. Fetches the latest autoconfig run state (queued, running, successful or failed). + /// + [Get("/api/v3/analysis/organizations/{provider}/{organizationName}/repositories/{repositoryName}/autoconfig/status")] + Task GetAutoconfigStatusAsync( + Provider provider, + string organizationName, + string repositoryName, + CancellationToken cancellationToken); + + /// + /// Reanalyze the coverage for a commit + /// + /// + /// Triggers the reanalysis of the latest coverage report uploaded for the commit. + /// Has no effect if the commit does not have any coverage report. + /// + [Post("/api/v3/coverage/organizations/{provider}/{organizationName}/repositories/{repositoryName}/commits/{commitUuid}/reanalyze")] + Task ReanalyzeCommitCoverageAsync( + Provider provider, + string organizationName, + string repositoryName, + string commitUuid, + CancellationToken cancellationToken); + + /// + /// Trigger an AI review for a pull request + /// + [Post("/api/v3/analysis/organizations/{provider}/{organizationName}/repositories/{repositoryName}/pull-requests/{pullRequestNumber}/ai-reviewer/trigger")] + Task TriggerPullRequestAiReviewAsync( + Provider provider, + string organizationName, + string repositoryName, + int pullRequestNumber, + CancellationToken cancellationToken); + + /// + /// Ignore the false positive result in an issue + /// + [Patch("/api/v3/analysis/organizations/{provider}/{organizationName}/repositories/{repositoryName}/issues/{issueId}/false-positive/ignore")] + Task IgnoreFalsePositiveAsync( + Provider provider, + string organizationName, + string repositoryName, + string issueId, + CancellationToken cancellationToken); + + /// + /// Reanalyze a specific commit in a repository + /// + [Post("/api/v3/organizations/{provider}/{organizationName}/repositories/{repositoryName}/reanalyzeCommit")] + Task ReanalyzeCommitByIdAsync( + Provider provider, + string organizationName, + string repositoryName, + [Body] CommitUuidRequest body, + CancellationToken cancellationToken); + + /// + /// Check if the repository has quick fix suggestions for a branch + /// + /// + /// Experimental. If branch is not provided, the default branch is used. + /// + [Get("/api/v3/analysis/organizations/{provider}/{organizationName}/repositories/{repositoryName}/issues/hasSuggestions")] + Task HasQuickfixSuggestionsAsync( + Provider provider, + string organizationName, + string repositoryName, + [Query] string? branch, + CancellationToken cancellationToken); + + /// + /// Get quick fixes for issues in patch format + /// + /// + /// Experimental. If branch is not provided, the default branch is used. + /// + [Get("/api/v3/analysis/organizations/{provider}/{organizationName}/repositories/{repositoryName}/issues/patch")] + Task GetQuickfixesPatchAsync( + Provider provider, + string organizationName, + string repositoryName, + [Query] string? branch, + CancellationToken cancellationToken); + + /// + /// Get quick fixes for pull request issues in patch format + /// + /// + /// Experimental. + /// + [Get("/api/v3/analysis/organizations/{provider}/{organizationName}/repositories/{repositoryName}/pull-requests/{pullRequestNumber}/issues/patch")] + Task GetPullRequestQuickfixesPatchAsync( + Provider provider, + string organizationName, + string repositoryName, + int pullRequestNumber, + CancellationToken cancellationToken); + + /// + /// Get the patterns overview for a coding standard tool + /// + [Get("/api/v3/organizations/{provider}/{organizationName}/coding-standards/{codingStandardId}/tools/{toolUuid}/patterns/overview")] + Task GetCodingStandardToolPatternsOverviewAsync( + Provider provider, + string organizationName, + long codingStandardId, + string toolUuid, + [Query] string? languages, + [Query] string? categories, + [Query] string? severityLevels, + [Query] string? tags, + [Query] string? search, + [Query] bool? enabled, + [Query] bool? recommended, + CancellationToken cancellationToken); +} diff --git a/Codacy.Api/Interfaces/IAnalysisApi.cs b/Codacy.Api/Interfaces/IAnalysisApi.cs index e4c75ef..83a9099 100644 --- a/Codacy.Api/Interfaces/IAnalysisApi.cs +++ b/Codacy.Api/Interfaces/IAnalysisApi.cs @@ -11,6 +11,10 @@ public interface IAnalysisApi /// /// List organization repositories with analysis information /// + /// + /// The repositories parameter is deprecated by Codacy, which limits repository filtering + /// to 100 names. Use instead. + /// [Get("/api/v3/analysis/organizations/{provider}/{organizationName}/repositories")] Task> ListOrganizationRepositoriesWithAnalysisAsync( Provider provider, @@ -372,6 +376,11 @@ Task ListPullRequestFilesAsync( /// /// List organization pull requests /// + /// + /// The repositories parameter is deprecated by Codacy, which names no replacement for + /// this endpoint. Its guidance for the parameter is to use + /// instead. + /// [Get("/api/v3/analysis/organizations/{provider}/{organizationName}/pull-requests")] Task ListOrganizationPullRequestsAsync( Provider provider, diff --git a/Codacy.Api/Interfaces/IBillingApi.cs b/Codacy.Api/Interfaces/IBillingApi.cs new file mode 100644 index 0000000..52c9176 --- /dev/null +++ b/Codacy.Api/Interfaces/IBillingApi.cs @@ -0,0 +1,91 @@ +using Codacy.Api.Models; +using Refit; + +namespace Codacy.Api.Interfaces; + +/// +/// Interface for billing and payment plan API operations +/// +public interface IBillingApi +{ + /// + /// Update the information about organization billing + /// + [Post("/api/v3/organizations/{provider}/{organizationName}/billing")] + Task UpdateOrganizationDetailedBillingAsync( + Provider provider, + string organizationName, + [Body] BillingDetailsUpdate body, + CancellationToken cancellationToken); + + /// + /// Get card information about organization billing + /// + [Get("/api/v3/organizations/{provider}/{organizationName}/billing/card")] + Task GetOrganizationBillingCardAsync( + Provider provider, + string organizationName, + CancellationToken cancellationToken); + + /// + /// Add a card to the organization + /// + [Post("/api/v3/organizations/{provider}/{organizationName}/billing/card")] + Task AddOrganizationBillingCardAsync( + Provider provider, + string organizationName, + [Body] CardCreation body, + CancellationToken cancellationToken); + + /// + /// Get a billing estimation + /// + [Get("/api/v3/organizations/{provider}/{organizationName}/billing/estimation")] + Task GetOrganizationBillingEstimationAsync( + Provider provider, + string organizationName, + [Query] string paymentPlanCode, + [Query] string? promoCode, + CancellationToken cancellationToken); + + /// + /// Change the plan of an organization + /// + [Post("/api/v3/organizations/{provider}/{organizationName}/billing/change-plan")] + Task ChangeOrganizationPlanAsync( + Provider provider, + string organizationName, + [Body] ChangePlan body, + CancellationToken cancellationToken); + + /// + /// Sync the information about organization billing + /// + [Post("/api/v3/organizations/{provider}/{organizationName}/billing/sync")] + Task SyncMarketplaceBillingAsync( + Provider provider, + string organizationName, + CancellationToken cancellationToken); + + /// + /// Sync the information about the billing of the organizations of the authenticated user + /// + [Post("/api/v3/user/billing/sync")] + Task SyncUserMarketplaceBillingAsync(CancellationToken cancellationToken); + + /// + /// Delete billing subscription for organization + /// + [Delete("/api/v3/billing/{provider}/{organizationName}/subscription")] + Task DeleteSubscriptionAsync( + Provider provider, + string organizationName, + [Body] ChurnFeedback body, + CancellationToken cancellationToken); + + /// + /// List available plans in Codacy + /// + [Get("/api/v3/plans")] + Task ListPaymentPlansAsync(CancellationToken cancellationToken); +} diff --git a/Codacy.Api/Interfaces/ICodacyClient.cs b/Codacy.Api/Interfaces/ICodacyClient.cs index 2d4100f..73014e5 100644 --- a/Codacy.Api/Interfaces/ICodacyClient.cs +++ b/Codacy.Api/Interfaces/ICodacyClient.cs @@ -1,4 +1,4 @@ -namespace Codacy.Api.Interfaces; +namespace Codacy.Api.Interfaces; /// /// Interface for the Codacy API client @@ -64,4 +64,119 @@ public interface ICodacyClient : IDisposable /// Gets the Security API module /// ISecurityApi Security { get; } + + /// + /// Gets the Sbom API module + /// + ISbomApi Sbom { get; } + + /// + /// Gets the Images API module + /// + IImagesApi Images { get; } + + /// + /// Gets the Reports API module + /// + IReportsApi Reports { get; } + + /// + /// Gets the AiInventory API module + /// + IAiInventoryApi AiInventory { get; } + + /// + /// Gets the Billing API module + /// + IBillingApi Billing { get; } + + /// + /// Gets the OrganizationSettings API module + /// + IOrganizationSettingsApi OrganizationSettings { get; } + + /// + /// Gets the Enterprises API module + /// + IEnterprisesApi Enterprises { get; } + + /// + /// Gets the Admin API module + /// + IAdminApi Admin { get; } + + /// + /// Gets the Platform API module + /// + IPlatformApi Platform { get; } + + /// + /// Gets the RepositorySettings API module + /// + IRepositorySettingsApi RepositorySettings { get; } + + /// + /// Gets the RepositoryApiTokens API module + /// + IRepositoryApiTokensApi RepositoryApiTokens { get; } + + /// + /// Gets the RepositoryFiles API module + /// + IRepositoryFilesApi RepositoryFiles { get; } + + /// + /// Gets the Diffs API module + /// + IDiffsApi Diffs { get; } + + /// + /// Gets the RepositoryCoverageReports API module + /// + IRepositoryCoverageReportsApi RepositoryCoverageReports { get; } + + /// + /// Gets the GatePolicies API module + /// + IGatePoliciesApi GatePolicies { get; } + + /// + /// Gets the Segments API module + /// + ISegmentsApi Segments { get; } + + /// + /// Gets the Jira API module + /// + IJiraApi Jira { get; } + + /// + /// Gets the Slack API module + /// + ISlackApi Slack { get; } + + /// + /// Gets the Dast API module + /// + IDastApi Dast { get; } + + /// + /// Gets the RepositoryToolPatterns API module + /// + IRepositoryToolPatternsApi RepositoryToolPatterns { get; } + + /// + /// Gets the AnalysisActions API module + /// + IAnalysisActionsApi AnalysisActions { get; } + + /// + /// Gets the Tools API module + /// + IToolsApi Tools { get; } + + /// + /// Gets the Metrics API module + /// + IMetricsApi Metrics { get; } } diff --git a/Codacy.Api/Interfaces/IDastApi.cs b/Codacy.Api/Interfaces/IDastApi.cs new file mode 100644 index 0000000..ac45229 --- /dev/null +++ b/Codacy.Api/Interfaces/IDastApi.cs @@ -0,0 +1,51 @@ +using Codacy.Api.Models; +using Refit; + +namespace Codacy.Api.Interfaces; + +/// +/// Interface for DAST API operations +/// +public interface IDastApi +{ + /// + /// List configured DAST targets + /// + [Get("/api/v3/organizations/{provider}/{organizationName}/dast/targets")] + Task> GetDastTargetsAsync( + Provider provider, + string organizationName, + [Query] string? cursor, + [Query] int? limit, + CancellationToken cancellationToken); + + /// + /// Create a DAST target + /// + [Post("/api/v3/organizations/{provider}/{organizationName}/dast/targets")] + Task CreateDastTargetAsync( + Provider provider, + string organizationName, + [Body] CreateDastTargetBody body, + CancellationToken cancellationToken); + + /// + /// Delete a DAST target + /// + [Delete("/api/v3/organizations/{provider}/{organizationName}/dast/targets/{dastTargetId}")] + Task DeleteDastTargetAsync( + Provider provider, + string organizationName, + long dastTargetId, + CancellationToken cancellationToken); + + /// + /// Enqueue a DAST analysis for the given target + /// + [Post("/api/v3/organizations/{provider}/{organizationName}/dast/targets/{dastTargetId}/analyze")] + Task AnalyzeDastTargetAsync( + Provider provider, + string organizationName, + long dastTargetId, + CancellationToken cancellationToken); +} diff --git a/Codacy.Api/Interfaces/IDiffsApi.cs b/Codacy.Api/Interfaces/IDiffsApi.cs new file mode 100644 index 0000000..d0b0677 --- /dev/null +++ b/Codacy.Api/Interfaces/IDiffsApi.cs @@ -0,0 +1,52 @@ +using Codacy.Api.Models; +using Refit; + +namespace Codacy.Api.Interfaces; + +/// +/// Interface for diff and commit detail API operations +/// +public interface IDiffsApi +{ + /// + /// Get the diff of a pull request + /// + [Get("/api/v3/organizations/{provider}/{organizationName}/repositories/{repositoryName}/pull-requests/{pullRequestNumber}/diff")] + Task GetPullRequestDiffAsync( + Provider provider, + string organizationName, + string repositoryName, + int pullRequestNumber, + CancellationToken cancellationToken); + + /// + /// Get the diff of a commit + /// + [Get("/api/v3/organizations/{provider}/{organizationName}/repositories/{repositoryName}/commits/{commitUuid}/diff")] + Task GetCommitDiffAsync( + Provider provider, + string organizationName, + string repositoryName, + string commitUuid, + CancellationToken cancellationToken); + + /// + /// Get the diff between two commits + /// + [Get("/api/v3/organizations/{provider}/{organizationName}/repositories/{repositoryName}/base/{baseCommitUuid}/head/{headCommitUuid}/diff")] + Task GetDiffBetweenCommitsAsync( + Provider provider, + string organizationName, + string repositoryName, + string baseCommitUuid, + string headCommitUuid, + CancellationToken cancellationToken); + + /// + /// Get the details of a commit by its identifier + /// + [Get("/api/v3/commits/{commitId}")] + Task GetCommitDetailsByCommitIdAsync( + long commitId, + CancellationToken cancellationToken); +} diff --git a/Codacy.Api/Interfaces/IEnterprisesApi.cs b/Codacy.Api/Interfaces/IEnterprisesApi.cs new file mode 100644 index 0000000..84db2c1 --- /dev/null +++ b/Codacy.Api/Interfaces/IEnterprisesApi.cs @@ -0,0 +1,84 @@ +using Codacy.Api.Models; +using Refit; + +namespace Codacy.Api.Interfaces; + +/// +/// Interface for enterprise API operations +/// +public interface IEnterprisesApi +{ + /// + /// List user enterprises + /// + [Get("/api/v3/enterprises/{provider}")] + Task> ListEnterprisesAsync( + Provider provider, + [Query] string? cursor, + [Query] int? limit, + CancellationToken cancellationToken); + + /// + /// Get an enterprise + /// + [Get("/api/v3/enterprises/{provider}/{enterpriseName}")] + Task GetEnterpriseAsync( + Provider provider, + string enterpriseName, + CancellationToken cancellationToken); + + /// + /// Get the organizations of an enterprise + /// + [Get("/api/v3/enterprises/{provider}/{enterpriseName}/organizations")] + Task> ListEnterpriseOrganizationsAsync( + Provider provider, + string enterpriseName, + [Query] string? cursor, + [Query] int? limit, + CancellationToken cancellationToken); + + /// + /// Get enterprise seats + /// + [Get("/api/v3/enterprises/{provider}/{enterpriseName}/seats")] + Task> ListEnterpriseSeatsAsync( + Provider provider, + string enterpriseName, + [Query] string? cursor, + [Query] int? limit, + [Query] string? search, + CancellationToken cancellationToken); + + /// + /// Get enterprise seats as a CSV file + /// + [Get("/api/v3/reports/enterprises/{provider}/{enterpriseName}/seats-csv")] + Task ListEnterpriseSeatsCsvAsync( + Provider provider, + string enterpriseName, + CancellationToken cancellationToken); + + /// + /// List user configured enterprise provider account tokens + /// + [Get("/api/v3/user/enterprise/integrations")] + Task> ListUserEnterpriseProviderTokensAsync( + CancellationToken cancellationToken); + + /// + /// Add an Enterprise account token + /// + [Post("/api/v3/user/enterprise/integrations")] + Task AddEnterpriseTokenAsync( + [Body] AddEnterpriseAccountTokenBody body, + CancellationToken cancellationToken); + + /// + /// Delete an Enterprise account token + /// + [Delete("/api/v3/user/enterprise/integrations/{provider}")] + Task DeleteEnterpriseTokenAsync( + Provider provider, + CancellationToken cancellationToken); +} diff --git a/Codacy.Api/Interfaces/IGatePoliciesApi.cs b/Codacy.Api/Interfaces/IGatePoliciesApi.cs new file mode 100644 index 0000000..713e639 --- /dev/null +++ b/Codacy.Api/Interfaces/IGatePoliciesApi.cs @@ -0,0 +1,114 @@ +using Codacy.Api.Models; +using Refit; + +namespace Codacy.Api.Interfaces; + +/// +/// Interface for Gate Policies API operations +/// +public interface IGatePoliciesApi +{ + /// + /// List the gate policies for an organization + /// + [Get("/api/v3/organizations/{provider}/{organizationName}/gate-policies")] + Task ListGatePoliciesAsync( + Provider provider, + string organizationName, + [Query] string? cursor, + [Query] int? limit, + CancellationToken cancellationToken); + + /// + /// Create a gate policy + /// + [Post("/api/v3/organizations/{provider}/{organizationName}/gate-policies")] + Task CreateGatePolicyAsync( + Provider provider, + string organizationName, + [Body] CreateGatePolicyBody body, + CancellationToken cancellationToken); + + /// + /// Get a gate policy + /// + [Get("/api/v3/organizations/{provider}/{organizationName}/gate-policies/{gatePolicyId}")] + Task GetGatePolicyAsync( + Provider provider, + string organizationName, + long gatePolicyId, + CancellationToken cancellationToken); + + /// + /// Update a gate policy + /// + [Patch("/api/v3/organizations/{provider}/{organizationName}/gate-policies/{gatePolicyId}")] + Task UpdateGatePolicyAsync( + Provider provider, + string organizationName, + long gatePolicyId, + [Body] UpdateGatePolicyBody body, + CancellationToken cancellationToken); + + /// + /// Delete a gate policy + /// + [Delete("/api/v3/organizations/{provider}/{organizationName}/gate-policies/{gatePolicyId}")] + Task DeleteGatePolicyAsync( + Provider provider, + string organizationName, + long gatePolicyId, + CancellationToken cancellationToken); + + /// + /// Set the gate policy as the default for an organization + /// + [Post("/api/v3/organizations/{provider}/{organizationName}/gate-policies/{gatePolicyId}/setDefault")] + Task SetDefaultGatePolicyAsync( + Provider provider, + string organizationName, + long gatePolicyId, + CancellationToken cancellationToken); + + /// + /// Set the built-in Codacy gate policy as the default for an organization + /// + [Post("/api/v3/organizations/{provider}/{organizationName}/gate-policies/setCodacyDefault")] + Task SetCodacyDefaultGatePolicyAsync( + Provider provider, + string organizationName, + CancellationToken cancellationToken); + + /// + /// List all repositories following a gate policy + /// + [Get("/api/v3/organizations/{provider}/{organizationName}/gate-policies/{gatePolicyId}/repositories")] + Task> ListRepositoriesFollowingGatePolicyAsync( + Provider provider, + string organizationName, + long gatePolicyId, + [Query] string? cursor, + [Query] int? limit, + CancellationToken cancellationToken); + + /// + /// Link or unlink a gate policy to a list of repositories + /// + [Put("/api/v3/organizations/{provider}/{organizationName}/gate-policies/{gatePolicyId}/repositories")] + Task ApplyGatePolicyToRepositoriesAsync( + Provider provider, + string organizationName, + long gatePolicyId, + [Body] ApplyGatePolicyToRepositoriesBody body, + CancellationToken cancellationToken); + + /// + /// Create a compliance standard for an organization + /// + [Post("/api/v3/organizations/{provider}/{organizationName}/compliance-standards")] + Task CreateComplianceStandardAsync( + Provider provider, + string organizationName, + [Body] CreateComplianceStandardBody body, + CancellationToken cancellationToken); +} diff --git a/Codacy.Api/Interfaces/IImagesApi.cs b/Codacy.Api/Interfaces/IImagesApi.cs new file mode 100644 index 0000000..0feb069 --- /dev/null +++ b/Codacy.Api/Interfaces/IImagesApi.cs @@ -0,0 +1,69 @@ +using Codacy.Api.Models; +using Refit; + +namespace Codacy.Api.Interfaces; + +/// +/// Interface for Docker image SBOM API operations +/// +public interface IImagesApi +{ + /// + /// Upload an SBOM (SPDX or CycloneDX) for a Docker image + /// + [Multipart] + [Post("/api/v3/organizations/{provider}/{organizationName}/image-sboms")] + Task UploadImageSbomAsync( + Provider provider, + string organizationName, + [AliasAs("sbom")] StreamPart sbom, + [AliasAs("imageName")] string imageName, + [AliasAs("tag")] string tag, + [AliasAs("repositoryName")] string? repositoryName, + [AliasAs("environment")] string? environment, + CancellationToken cancellationToken); + + /// + /// Delete all SBOMs for a given image + /// + [Delete("/api/v3/organizations/{provider}/{organizationName}/image-sboms/{imageName}")] + Task DeleteImageSbomsAsync( + Provider provider, + string organizationName, + string imageName, + CancellationToken cancellationToken); + + /// + /// Delete the SBOM for a given image and tag + /// + [Delete("/api/v3/organizations/{provider}/{organizationName}/image-sboms/{imageName}/tags/{tag}")] + Task DeleteImageTagAsync( + Provider provider, + string organizationName, + string imageName, + string tag, + CancellationToken cancellationToken); + + /// + /// List Docker images for an organization + /// + [Get("/api/v3/organizations/{provider}/{organizationName}/images")] + Task ListOrganizationImagesAsync( + Provider provider, + string organizationName, + [Query] string? cursor, + [Query] int? limit, + CancellationToken cancellationToken); + + /// + /// List the tags of a Docker image + /// + [Get("/api/v3/organizations/{provider}/{organizationName}/images/{imageName}/tags")] + Task> ListImageTagsAsync( + Provider provider, + string organizationName, + string imageName, + [Query] string? cursor, + [Query] int? limit, + CancellationToken cancellationToken); +} diff --git a/Codacy.Api/Interfaces/IIssuesApi.cs b/Codacy.Api/Interfaces/IIssuesApi.cs index 4953d37..1bfff03 100644 --- a/Codacy.Api/Interfaces/IIssuesApi.cs +++ b/Codacy.Api/Interfaces/IIssuesApi.cs @@ -69,7 +69,7 @@ Task GetIssuesOverviewAsync( /// /// Search ignored issues /// - [Post("/api/v3/analysis/organizations/{provider}/{organizationName}/repositories/{repositoryName}/issues/ignored/search")] + [Post("/api/v3/analysis/organizations/{provider}/{organizationName}/repositories/{repositoryName}/ignoredIssues/search")] Task> SearchRepositoryIgnoredIssuesAsync( Provider provider, string organizationName, diff --git a/Codacy.Api/Interfaces/IJiraApi.cs b/Codacy.Api/Interfaces/IJiraApi.cs new file mode 100644 index 0000000..bf4f996 --- /dev/null +++ b/Codacy.Api/Interfaces/IJiraApi.cs @@ -0,0 +1,107 @@ +using Codacy.Api.Models; +using Refit; + +namespace Codacy.Api.Interfaces; + +/// +/// Interface for Jira integration API operations +/// +public interface IJiraApi +{ + /// + /// Get the Jira integration of the organization + /// + [Get("/api/v3/organizations/{provider}/{organizationName}/integrations/jira")] + Task GetJiraIntegrationAsync( + Provider provider, + string organizationName, + CancellationToken cancellationToken); + + /// + /// Create or update the Jira integration of the organization + /// + [Put("/api/v3/organizations/{provider}/{organizationName}/integrations/jira")] + Task CreateOrUpdateJiraIntegrationAsync( + Provider provider, + string organizationName, + [Query] string oauthCode, + CancellationToken cancellationToken); + + /// + /// Delete the Jira integration of the organization and associated resources + /// + [Delete("/api/v3/organizations/{provider}/{organizationName}/integrations/jira")] + Task DeleteJiraIntegrationAsync( + Provider provider, + string organizationName, + CancellationToken cancellationToken); + + /// + /// Get Jira tickets for a Codacy element + /// + [Get("/api/v3/organizations/{provider}/{organizationName}/integrations/jira/tickets")] + Task GetJiraTicketsAsync( + Provider provider, + string organizationName, + [Query] ElementType elementType, + [Query] string elementId, + CancellationToken cancellationToken); + + /// + /// Create a Jira ticket + /// + [Post("/api/v3/organizations/{provider}/{organizationName}/integrations/jira/tickets")] + Task CreateJiraTicketAsync( + Provider provider, + string organizationName, + [Body] CreateJiraTicketBody body, + CancellationToken cancellationToken); + + /// + /// Unlink a Jira ticket from a repository + /// + [Delete("/api/v3/organizations/{provider}/{organizationName}/integrations/jira/tickets/{jiraTicketIdentifier}")] + Task UnlinkRepositoryJiraTicketAsync( + Provider provider, + string organizationName, + long jiraTicketIdentifier, + [Body] UnlinkRepositoryJiraTicketBody body, + CancellationToken cancellationToken); + + /// + /// Get available Jira projects for the organization + /// + [Get("/api/v3/organizations/{provider}/{organizationName}/integrations/jira/projects")] + Task GetAvailableJiraProjectsAsync( + Provider provider, + string organizationName, + [Query] string? search, + [Query] string? cursor, + [Query] int? limit, + CancellationToken cancellationToken); + + /// + /// Get available issue types for a Jira project + /// + [Get("/api/v3/organizations/{provider}/{organizationName}/integrations/jira/projects/{jiraProjectId}/issueTypes")] + Task GetJiraProjectIssueTypesAsync( + Provider provider, + string organizationName, + long jiraProjectId, + [Query] string? cursor, + [Query] int? limit, + CancellationToken cancellationToken); + + /// + /// Get available fields by issue type for a Jira project + /// + [Get("/api/v3/organizations/{provider}/{organizationName}/integrations/jira/projects/{jiraProjectId}/issueTypes/{jiraIssueTypeId}/fields")] + Task GetJiraProjectIssueFieldsAsync( + Provider provider, + string organizationName, + long jiraProjectId, + string jiraIssueTypeId, + [Query] string? cursor, + [Query] int? limit, + CancellationToken cancellationToken); +} diff --git a/Codacy.Api/Interfaces/IMetricsApi.cs b/Codacy.Api/Interfaces/IMetricsApi.cs new file mode 100644 index 0000000..d4b3e1a --- /dev/null +++ b/Codacy.Api/Interfaces/IMetricsApi.cs @@ -0,0 +1,154 @@ +using Codacy.Api.Models; +using Refit; + +namespace Codacy.Api.Interfaces; + +/// +/// Interface for organization and enterprise metrics API operations +/// +public interface IMetricsApi +{ + /// + /// Start collecting metrics for an organization + /// + /// + /// Starts data collection for missing metrics. The organization must have metrics support enabled. + /// + [Post("/api/v3/organizations/{provider}/{organizationName}/metrics/start")] + Task InitiateMetricsForOrganizationAsync( + Provider provider, + string organizationName, + [Body] MetricsFilter? body, + CancellationToken cancellationToken); + + /// + /// Get the metrics that are ready for an organization + /// + [Get("/api/v3/organizations/{provider}/{organizationName}/metrics/ready")] + Task ReadyMetricsForOrganizationAsync( + Provider provider, + string organizationName, + CancellationToken cancellationToken); + + /// + /// Get the latest value of a metric + /// + /// + /// Works for aggregating metrics (such as open issues) but not accumulating metrics (such as fixed issues). + /// + [Post("/api/v3/organizations/{provider}/{organizationName}/metrics/{metricName}/latest")] + Task RetrieveLatestMetricValueAsync( + Provider provider, + string organizationName, + string metricName, + [Body] MetricFilter body, + CancellationToken cancellationToken); + + /// + /// Get the latest metric values grouped by dimension + /// + [Post("/api/v3/organizations/{provider}/{organizationName}/metrics/{metricName}/latest-grouped")] + Task RetrieveLatestMetricGroupedValuesAsync( + Provider provider, + string organizationName, + string metricName, + [Body] GroupMetricFilter body, + CancellationToken cancellationToken); + + /// + /// Get the metric value for a specific period + /// + [Post("/api/v3/organizations/{provider}/{organizationName}/metrics/{metricName}/period")] + Task RetrieveValueForPeriodAsync( + Provider provider, + string organizationName, + string metricName, + [Body] PeriodMetricFilterBody body, + CancellationToken cancellationToken); + + /// + /// Get the metric values for a specific period grouped by dimension + /// + [Post("/api/v3/organizations/{provider}/{organizationName}/metrics/{metricName}/period-grouped")] + Task RetrieveGroupedValuesForPeriodAsync( + Provider provider, + string organizationName, + string metricName, + [Body] PeriodGroupMetricFilterBody body, + CancellationToken cancellationToken); + + /// + /// Get the metric values for a time range + /// + [Post("/api/v3/organizations/{provider}/{organizationName}/metrics/{metricName}/timerange")] + Task RetrieveTimerangeMetricValuesAsync( + Provider provider, + string organizationName, + string metricName, + [Body] TimerangeMetricFilterBody body, + CancellationToken cancellationToken); + + /// + /// Get the metrics that are ready for each organization in an enterprise + /// + [Get("/api/v3/enterprises/{provider}/{enterpriseName}/metrics/ready")] + Task ReadyMetricsForEnterpriseAsync( + Provider provider, + string enterpriseName, + CancellationToken cancellationToken); + + /// + /// Get the latest metric values for all organizations in an enterprise + /// + [Post("/api/v3/enterprises/{provider}/{enterpriseName}/metrics/{metricName}/latest")] + Task RetrieveLatestMetricValueForEnterpriseAsync( + Provider provider, + string enterpriseName, + string metricName, + [Body] EnterpriseMetricFilter? body, + CancellationToken cancellationToken); + + /// + /// Get the latest metric values grouped by dimension for all organizations in an enterprise + /// + [Post("/api/v3/enterprises/{provider}/{enterpriseName}/metrics/{metricName}/latest-grouped")] + Task RetrieveLatestMetricGroupedValuesForEnterpriseAsync( + Provider provider, + string enterpriseName, + string metricName, + [Body] EnterpriseGroupMetricFilter body, + CancellationToken cancellationToken); + + /// + /// Get the metric values for a specific period for all organizations in an enterprise + /// + [Post("/api/v3/enterprises/{provider}/{enterpriseName}/metrics/{metricName}/period")] + Task RetrieveValueForPeriodForEnterpriseAsync( + Provider provider, + string enterpriseName, + string metricName, + [Body] EnterprisePeriodMetricFilterBody body, + CancellationToken cancellationToken); + + /// + /// Get the metric values grouped by dimension for a specific period for all organizations in an enterprise + /// + [Post("/api/v3/enterprises/{provider}/{enterpriseName}/metrics/{metricName}/period-grouped")] + Task RetrieveGroupedValuesForPeriodForEnterpriseAsync( + Provider provider, + string enterpriseName, + string metricName, + [Body] EnterprisePeriodGroupMetricFilterBody body, + CancellationToken cancellationToken); + + /// + /// Get the metric values for a time range for all organizations in an enterprise + /// + [Post("/api/v3/enterprises/{provider}/{enterpriseName}/metrics/{metricName}/timerange")] + Task RetrieveTimerangeMetricValuesForEnterpriseAsync( + Provider provider, + string enterpriseName, + string metricName, + [Body] EnterpriseTimerangeMetricFilterBody body, + CancellationToken cancellationToken); +} diff --git a/Codacy.Api/Interfaces/IOrganizationSettingsApi.cs b/Codacy.Api/Interfaces/IOrganizationSettingsApi.cs new file mode 100644 index 0000000..f108436 --- /dev/null +++ b/Codacy.Api/Interfaces/IOrganizationSettingsApi.cs @@ -0,0 +1,163 @@ +using Codacy.Api.Models; +using Refit; + +namespace Codacy.Api.Interfaces; + +/// +/// Interface for organization settings, membership and audit API operations +/// +public interface IOrganizationSettingsApi +{ + /// + /// Get organization by provider installation id + /// + [Get("/api/v3/organizations/{provider}/installation/{installationId}")] + Task GetOrganizationByInstallationIdAsync( + Provider provider, + long installationId, + CancellationToken cancellationToken); + + /// + /// Add an organization to Codacy + /// + [Post("/api/v3/organizations")] + Task AddOrganizationAsync( + [Body] AddOrganizationBody body, + CancellationToken cancellationToken); + + /// + /// Apply default settings to all repositories + /// + [Post("/api/v3/organizations/{provider}/{organizationName}/integrations/providerSettings/apply")] + Task ApplyProviderSettingsAsync( + Provider provider, + string organizationName, + CancellationToken cancellationToken); + + /// + /// Get Git provider settings + /// + [Get("/api/v3/organizations/{provider}/{organizationName}/integrations/providerSettings")] + Task GetProviderSettingsAsync( + Provider provider, + string organizationName, + CancellationToken cancellationToken); + + /// + /// Create or update Git provider settings + /// + [Patch("/api/v3/organizations/{provider}/{organizationName}/integrations/providerSettings")] + Task UpdateProviderSettingsAsync( + Provider provider, + string organizationName, + [Body] ProviderIntegrationSettingsPatchBody body, + CancellationToken cancellationToken); + + /// + /// Retrieve the onboarding progress of an organization + /// + [Get("/api/v3/onboarding/organizations/{provider}/{organizationName}/progress")] + Task RetrieveOrganizationOnboardingProgressAsync( + Provider provider, + string organizationName, + CancellationToken cancellationToken); + + /// + /// Configure what the organization members can do across the Codacy platform + /// + [Patch("/api/v3/organizations/{provider}/{organizationName}/analysisConfigurationMinimumPermission")] + Task PatchOrganizationSettingsAsync( + Provider provider, + string organizationName, + [Body] MembershipPrivilegesBody body, + CancellationToken cancellationToken); + + /// + /// Get the status of Codacy Git provider app permissions for an organization + /// + [Get("/api/v3/organizations/{provider}/{organizationName}/gitProviderAppPermissions")] + Task GetGitProviderAppPermissionsAsync( + Provider provider, + string organizationName, + CancellationToken cancellationToken); + + /// + /// Update the join mode of an organization + /// + [Post("/api/v3/organizations/{provider}/{organizationName}/joinMode")] + Task UpdateJoinModeAsync( + Provider provider, + string organizationName, + [Body] JoinModeRequest body, + CancellationToken cancellationToken); + + /// + /// Check if the user can leave the organization + /// + [Get("/api/v3/organizations/{provider}/{organizationName}/people/leave/check")] + Task CheckIfUserCanLeaveAsync( + Provider provider, + string organizationName, + CancellationToken cancellationToken); + + /// + /// List requests to join an organization + /// + [Get("/api/v3/organizations/{provider}/{organizationName}/join")] + Task> ListOrganizationJoinRequestsAsync( + Provider provider, + string organizationName, + [Query] string? cursor, + [Query] int? limit, + [Query] string? search, + CancellationToken cancellationToken); + + /// + /// Decline requests to join an organization + /// + [Delete("/api/v3/organizations/{provider}/{organizationName}/join")] + Task DeclineRequestsToJoinOrganizationAsync( + Provider provider, + string organizationName, + [Body] List emails, + CancellationToken cancellationToken); + + /// + /// Delete a request to join an organization + /// + [Delete("/api/v3/organizations/{provider}/{organizationName}/join/{accountIdentifier}")] + Task DeleteOrganizationJoinRequestAsync( + Provider provider, + string organizationName, + long accountIdentifier, + CancellationToken cancellationToken); + + /// + /// Retrieve the audit logs for the organization + /// + [Get("/api/v3/organizations/{provider}/{organizationName}/audit")] + Task> ListAuditLogsForOrganizationAsync( + Provider provider, + string organizationName, + [Query][AliasAs("from")] long? fromTimestamp, + [Query][AliasAs("to")] long? toTimestamp, + CancellationToken cancellationToken); + + /// + /// Check if the submodules option is enabled for the organization + /// + [Get("/api/v3/organizations/{provider}/{organizationName}/settings/submodules/check")] + Task CheckSubmodulesAsync( + Provider provider, + string organizationName, + CancellationToken cancellationToken); + + /// + /// Get AI Risk Checklist for an organization + /// + [Get("/api/v3/organizations/{provider}/{organizationName}/ai-risk-checklist")] + Task GetAiRiskCheckListAsync( + Provider provider, + string organizationName, + CancellationToken cancellationToken); +} diff --git a/Codacy.Api/Interfaces/IOrganizationsApi.cs b/Codacy.Api/Interfaces/IOrganizationsApi.cs index d846b41..7becaf7 100644 --- a/Codacy.Api/Interfaces/IOrganizationsApi.cs +++ b/Codacy.Api/Interfaces/IOrganizationsApi.cs @@ -86,6 +86,7 @@ Task RemovePeopleFromOrganizationAsync( /// /// Clean organization cache /// + [Obsolete("Codacy has removed this endpoint from its API; calls return 404.")] [Post("/api/v3/organizations/{provider}/{organizationName}/cache/clean")] Task CleanCacheAsync( Provider provider, @@ -104,9 +105,41 @@ Task JoinOrganizationAsync( /// /// Sync organization name with Git provider /// - [Post("/api/v3/organizations/{provider}/{organizationName}/sync")] + [Post("/api/v3/organizations/{provider}/{organizationName}/settings/sync")] Task SyncOrganizationNameAsync( Provider provider, string organizationName, CancellationToken cancellationToken); + + /// + /// List the webhook endpoints of an organization. Requires organization write permission. + /// + [Get("/api/v3/organizations/{provider}/{organizationName}/integrations/webhooks")] + Task ListWebhookEndpointsAsync( + Provider provider, + string organizationName, + CancellationToken cancellationToken); + + /// + /// Add a webhook endpoint to an organization. Codacy POSTs a quality.analysis.completed + /// delivery to it when a branch or pull request analysis finishes. The response holds the + /// signing secret, which is never returned again. Requires organization write permission and + /// a plan with webhooks enabled (403 otherwise). + /// + [Post("/api/v3/organizations/{provider}/{organizationName}/integrations/webhooks")] + Task CreateWebhookEndpointAsync( + Provider provider, + string organizationName, + [Body] CreateWebhookEndpointBody body, + CancellationToken cancellationToken); + + /// + /// Delete a webhook endpoint from an organization. Requires organization write permission. + /// + [Delete("/api/v3/organizations/{provider}/{organizationName}/integrations/webhooks/{webhookId}")] + Task DeleteWebhookEndpointAsync( + Provider provider, + string organizationName, + Guid webhookId, + CancellationToken cancellationToken); } diff --git a/Codacy.Api/Interfaces/IPlatformApi.cs b/Codacy.Api/Interfaces/IPlatformApi.cs new file mode 100644 index 0000000..4a82507 --- /dev/null +++ b/Codacy.Api/Interfaces/IPlatformApi.cs @@ -0,0 +1,48 @@ +using Codacy.Api.Models; +using Refit; + +namespace Codacy.Api.Interfaces; + +/// +/// Interface for platform-level API operations (login, configuration, health and session) +/// +public interface IPlatformApi +{ + /// + /// List configured login providers on Codacy's platform + /// + [Get("/api/v3/login/integrations")] + Task> ListConfiguredLoginIntegrationsAsync( + [Query] string? cursor, + [Query] int? limit, + CancellationToken cancellationToken); + + /// + /// List provider integrations existing on Codacy's platform + /// + [Get("/api/v3/provider/integrations")] + Task> ListProviderIntegrationsAsync( + [Query] string? cursor, + [Query] int? limit, + CancellationToken cancellationToken); + + /// + /// Get configuration status + /// + [Get("/api/v3/configuration/status")] + Task GetConfigurationStatusAsync(CancellationToken cancellationToken); + + /// + /// Health check endpoint + /// + [Get("/api/v3/health")] + Task HealthAsync(CancellationToken cancellationToken); + + /// + /// Send a heartbeat to keep the session alive + /// + [Post("/api/v3/session/heartbeat")] + Task HeartbeatAsync( + [Body] HeartbeatRequest body, + CancellationToken cancellationToken); +} diff --git a/Codacy.Api/Interfaces/IReportsApi.cs b/Codacy.Api/Interfaces/IReportsApi.cs new file mode 100644 index 0000000..8043ed6 --- /dev/null +++ b/Codacy.Api/Interfaces/IReportsApi.cs @@ -0,0 +1,45 @@ +using Codacy.Api.Models; +using Refit; + +namespace Codacy.Api.Interfaces; + +/// +/// Interface for CSV report API operations. Each method returns the raw (chunked) CSV stream, which the caller must dispose. +/// +public interface IReportsApi +{ + /// + /// Generate a CSV of all security and risk management items for an organization + /// + [Get("/api/v3/reports/organizations/{provider}/{organizationName}/security/items")] + Task GetReportSecurityItemsAsync( + Provider provider, + string organizationName, + CancellationToken cancellationToken); + + /// + /// Generate a filtered CSV of security and risk management items + /// + /// + /// The body is non-nullable because Codacy rejects a null one. Pass an empty instance to export unfiltered. + /// + [Post("/api/v3/reports/organizations/{provider}/{organizationName}/security/items/search")] + Task SearchReportSecurityItemsAsync( + Provider provider, + string organizationName, + [Body] PostReportSecurityItemsBody body, + CancellationToken cancellationToken); + + /// + /// Search the SBOM dependencies of an organization as CSV + /// + /// + /// The body is non-nullable because Codacy rejects a null one. Pass an empty instance to export unfiltered. + /// + [Post("/api/v3/reports/organizations/{provider}/{organizationName}/sbom/dependencies/search")] + Task SearchReportSbomDependenciesAsync( + Provider provider, + string organizationName, + [Body] SearchSbomDependenciesBody body, + CancellationToken cancellationToken); +} diff --git a/Codacy.Api/Interfaces/IRepositoryApiTokensApi.cs b/Codacy.Api/Interfaces/IRepositoryApiTokensApi.cs new file mode 100644 index 0000000..3790cbd --- /dev/null +++ b/Codacy.Api/Interfaces/IRepositoryApiTokensApi.cs @@ -0,0 +1,53 @@ +using Codacy.Api.Models; +using Refit; + +namespace Codacy.Api.Interfaces; + +/// +/// Interface for repository API token operations +/// +public interface IRepositoryApiTokensApi +{ + /// + /// List repository API tokens + /// + [Get("/api/v3/organizations/{provider}/{organizationName}/repositories/{repositoryName}/tokens")] + Task> ListRepositoryApiTokensAsync( + Provider provider, + string organizationName, + string repositoryName, + CancellationToken cancellationToken); + + /// + /// Create a repository API token + /// + [Post("/api/v3/organizations/{provider}/{organizationName}/repositories/{repositoryName}/tokens")] + Task CreateRepositoryApiTokenAsync( + Provider provider, + string organizationName, + string repositoryName, + [Body] RepositoryApiTokenCreateRequest? body, + CancellationToken cancellationToken); + + /// + /// Delete several repository API tokens + /// + [Post("/api/v3/organizations/{provider}/{organizationName}/repositories/{repositoryName}/tokens/delete")] + Task DeleteRepositoryApiTokensAsync( + Provider provider, + string organizationName, + string repositoryName, + [Body] RepositoryApiTokensDeleteRequest body, + CancellationToken cancellationToken); + + /// + /// Delete a repository API token + /// + [Delete("/api/v3/organizations/{provider}/{organizationName}/repositories/{repositoryName}/tokens/{tokenId}")] + Task DeleteRepositoryApiTokenAsync( + Provider provider, + string organizationName, + string repositoryName, + long tokenId, + CancellationToken cancellationToken); +} diff --git a/Codacy.Api/Interfaces/IRepositoryCoverageReportsApi.cs b/Codacy.Api/Interfaces/IRepositoryCoverageReportsApi.cs new file mode 100644 index 0000000..f83b63b --- /dev/null +++ b/Codacy.Api/Interfaces/IRepositoryCoverageReportsApi.cs @@ -0,0 +1,46 @@ +using Codacy.Api.Models; +using Refit; + +namespace Codacy.Api.Interfaces; + +/// +/// Interface for repository coverage report API operations +/// +public interface IRepositoryCoverageReportsApi +{ + /// + /// List the latest coverage reports of a repository + /// + [Get("/api/v3/organizations/{provider}/{organizationName}/repositories/{repositoryName}/coverage/status")] + Task ListCoverageReportsAsync( + Provider provider, + string organizationName, + string repositoryName, + [Query] int? limit, + CancellationToken cancellationToken); + + /// + /// List the coverage reports of a commit + /// + [Get("/api/v3/organizations/{provider}/{organizationName}/repositories/{repositoryName}/commits/{commitUuid}/coverage/reports")] + Task> ListCommitCoverageReportsAsync( + Provider provider, + string organizationName, + string repositoryName, + string commitUuid, + [Query] string? cursor, + [Query] int? limit, + CancellationToken cancellationToken); + + /// + /// Get a coverage report of a commit + /// + [Get("/api/v3/organizations/{provider}/{organizationName}/repositories/{repositoryName}/commits/{commitUuid}/coverage/reports/{reportUuid}")] + Task GetCoverageReportAsync( + Provider provider, + string organizationName, + string repositoryName, + string commitUuid, + string reportUuid, + CancellationToken cancellationToken); +} diff --git a/Codacy.Api/Interfaces/IRepositoryFilesApi.cs b/Codacy.Api/Interfaces/IRepositoryFilesApi.cs new file mode 100644 index 0000000..aeb29b3 --- /dev/null +++ b/Codacy.Api/Interfaces/IRepositoryFilesApi.cs @@ -0,0 +1,102 @@ +using Codacy.Api.Models; +using Refit; + +namespace Codacy.Api.Interfaces; + +/// +/// Interface for repository file and directory API operations +/// +public interface IRepositoryFilesApi +{ + /// + /// List the folders of a repository + /// + [Get("/api/v3/organizations/{provider}/{organizationName}/repositories/{repositoryName}/directories")] + Task> ListDirectoriesAsync( + Provider provider, + string organizationName, + string repositoryName, + [Query] string? branch, + [Query] string? path, + [Query] string? sort, + [Query] string? direction, + [Query] string? cursor, + [Query] int? limit, + CancellationToken cancellationToken); + + /// + /// List the ignored files of a repository + /// + [Get("/api/v3/organizations/{provider}/{organizationName}/repositories/{repositoryName}/ignored-files")] + Task ListIgnoredFilesAsync( + Provider provider, + string organizationName, + string repositoryName, + [Query] string? branch, + [Query] string? search, + [Query] string? cursor, + [Query] int? limit, + CancellationToken cancellationToken); + + /// + /// Get the duplicated code blocks of a file + /// + [Get("/api/v3/organizations/{provider}/{organizationName}/repositories/{repositoryName}/files/{fileId}/duplication")] + Task> GetFileClonesAsync( + Provider provider, + string organizationName, + string repositoryName, + long fileId, + [Query] string? cursor, + [Query] int? limit, + CancellationToken cancellationToken); + + /// + /// Get the issues of a file + /// + [Get("/api/v3/organizations/{provider}/{organizationName}/repositories/{repositoryName}/files/{fileId}/issues")] + Task> GetFileIssuesAsync( + Provider provider, + string organizationName, + string repositoryName, + long fileId, + [Query] string? cursor, + [Query] int? limit, + CancellationToken cancellationToken); + + /// + /// Get the content of a file, optionally restricted to a range of lines + /// + [Get("/api/v3/organizations/{provider}/{organizationName}/repositories/{repositoryName}/files/{filePath}/content")] + Task GetFileContentAsync( + Provider provider, + string organizationName, + string repositoryName, + string filePath, + [Query] int? startLine, + [Query] int? endLine, + [Query] string? commitRef, + CancellationToken cancellationToken); + + /// + /// Get the coverage of a file + /// + [Get("/api/v3/organizations/{provider}/{organizationName}/repositories/{repositoryName}/files/{fileId}/coverage")] + Task GetFileCoverageAsync( + Provider provider, + string organizationName, + string repositoryName, + long fileId, + CancellationToken cancellationToken); + + /// + /// Update the ignored status of a file + /// + [Patch("/api/v3/organizations/{provider}/{organizationName}/repositories/{repositoryName}/file")] + Task UpdateFileStateAsync( + Provider provider, + string organizationName, + string repositoryName, + [Body] FileStateBody body, + CancellationToken cancellationToken); +} diff --git a/Codacy.Api/Interfaces/IRepositorySettingsApi.cs b/Codacy.Api/Interfaces/IRepositorySettingsApi.cs new file mode 100644 index 0000000..83f0689 --- /dev/null +++ b/Codacy.Api/Interfaces/IRepositorySettingsApi.cs @@ -0,0 +1,204 @@ +using Codacy.Api.Models; +using Refit; + +namespace Codacy.Api.Interfaces; + +/// +/// Interface for repository settings API operations +/// +public interface IRepositorySettingsApi +{ + /// + /// Get quality settings for the specific repository + /// + [Get("/api/v3/organizations/{provider}/{organizationName}/repositories/{repositoryName}/settings/quality/repository")] + Task GetQualitySettingsForRepositoryAsync( + Provider provider, + string organizationName, + string repositoryName, + CancellationToken cancellationToken); + + /// + /// Update quality goals settings for the specific repository + /// + [Put("/api/v3/organizations/{provider}/{organizationName}/repositories/{repositoryName}/settings/quality/repository")] + Task UpdateRepositoryQualitySettingsAsync( + Provider provider, + string organizationName, + string repositoryName, + [Body] RepositoryQualitySettings settings, + CancellationToken cancellationToken); + + /// + /// Regenerate the user SSH key that Codacy uses to clone the repository + /// + [Post("/api/v3/organizations/{provider}/{organizationName}/repositories/{repositoryName}/settings/ssh-user-key")] + Task RegenerateUserSshKeyAsync( + Provider provider, + string organizationName, + string repositoryName, + CancellationToken cancellationToken); + + /// + /// Regenerate the SSH key that Codacy uses to clone the repository + /// + [Post("/api/v3/organizations/{provider}/{organizationName}/repositories/{repositoryName}/settings/ssh-repository-key")] + Task RegenerateRepositorySshKeyAsync( + Provider provider, + string organizationName, + string repositoryName, + CancellationToken cancellationToken); + + /// + /// Get the public SSH key for the repository + /// + [Get("/api/v3/organizations/{provider}/{organizationName}/repositories/{repositoryName}/settings/stored-ssh-key")] + Task GetRepositoryPublicSshKeyAsync( + Provider provider, + string organizationName, + string repositoryName, + CancellationToken cancellationToken); + + /// + /// Synchronize repository name and visibility with Git provider + /// + [Post("/api/v3/organizations/{provider}/{organizationName}/repositories/{repositoryName}/settings/sync")] + Task SyncRepositoryWithProviderAsync( + Provider provider, + string organizationName, + string repositoryName, + CancellationToken cancellationToken); + + /// + /// Get the status of the repository setting Run analysis on your build server + /// + [Get("/api/v3/organizations/{provider}/{organizationName}/repositories/{repositoryName}/settings/analysis")] + Task GetBuildServerAnalysisSettingAsync( + Provider provider, + string organizationName, + string repositoryName, + CancellationToken cancellationToken); + + /// + /// Update the status of the repository setting Run analysis on your build server + /// + [Patch("/api/v3/organizations/{provider}/{organizationName}/repositories/{repositoryName}/settings/analysis")] + Task UpdateBuildServerAnalysisSettingAsync( + Provider provider, + string organizationName, + string repositoryName, + [Body] BuildServerAnalysisSettingRequest body, + CancellationToken cancellationToken); + + /// + /// Get the list of all languages with their extensions and enabled status + /// + [Get("/api/v3/organizations/{provider}/{organizationName}/repositories/{repositoryName}/settings/languages")] + Task GetRepositoryLanguagesAsync( + Provider provider, + string organizationName, + string repositoryName, + CancellationToken cancellationToken); + + /// + /// Configure language settings for this repository + /// + [Patch("/api/v3/organizations/{provider}/{organizationName}/repositories/{repositoryName}/settings/languages")] + Task PatchRepositoryLanguageResponseSettingsAsync( + Provider provider, + string organizationName, + string repositoryName, + [Body] RepositoryLanguagesBody body, + CancellationToken cancellationToken); + + /// + /// Reset quality settings for the commits of a repository to default values + /// + [Post("/api/v3/organizations/{provider}/{organizationName}/repositories/{repositoryName}/settings/quality/commits/reset")] + Task ResetCommitsQualitySettingsAsync( + Provider provider, + string organizationName, + string repositoryName, + CancellationToken cancellationToken); + + /// + /// Reset quality settings for the pull requests of a repository to default values + /// + [Post("/api/v3/organizations/{provider}/{organizationName}/repositories/{repositoryName}/settings/quality/pull-requests/reset")] + Task ResetPullRequestsQualitySettingsAsync( + Provider provider, + string organizationName, + string repositoryName, + CancellationToken cancellationToken); + + /// + /// Reset quality settings for the repository to default values + /// + [Post("/api/v3/organizations/{provider}/{organizationName}/repositories/{repositoryName}/settings/quality/repository/reset")] + Task ResetRepositoryQualitySettingsAsync( + Provider provider, + string organizationName, + string repositoryName, + CancellationToken cancellationToken); + + /// + /// Get the Git provider integration settings of the repository + /// + [Get("/api/v3/organizations/{provider}/{organizationName}/repositories/{repositoryName}/integrations/providerSettings")] + Task GetRepositoryIntegrationsSettingsAsync( + Provider provider, + string organizationName, + string repositoryName, + CancellationToken cancellationToken); + + /// + /// Update the Git provider integration settings of the repository + /// + [Patch("/api/v3/organizations/{provider}/{organizationName}/repositories/{repositoryName}/integrations/providerSettings")] + Task UpdateRepositoryIntegrationsSettingsAsync( + Provider provider, + string organizationName, + string repositoryName, + [Body] ProviderIntegrationSettingsPatchBody body, + CancellationToken cancellationToken); + + /// + /// Create the post-commit hook on the Git provider + /// + [Get("/api/v3/organizations/{provider}/{organizationName}/repositories/{repositoryName}/integrations/postCommitHook")] + Task CreatePostCommitHookAsync( + Provider provider, + string organizationName, + string repositoryName, + CancellationToken cancellationToken); + + /// + /// Refresh the repository Git provider integration + /// + [Post("/api/v3/organizations/{provider}/{organizationName}/repositories/{repositoryName}/integrations/refreshProvider")] + Task RefreshProviderRepositoryIntegrationAsync( + Provider provider, + string organizationName, + string repositoryName, + CancellationToken cancellationToken); + + /// + /// Create a pull request that adds the Codacy badge to the repository (GitHub only) + /// + [Post("/api/v3/organizations/gh/{organizationName}/repositories/{repositoryName}/badge")] + Task CreateBadgePullRequestAsync( + string organizationName, + string repositoryName, + CancellationToken cancellationToken); + + /// + /// Get the Codacy checks required before merge on a branch + /// + [Get("/api/v3/organizations/{provider}/{organizationName}/repositories/{repositoryName}/branches/{branchName}/required-checks")] + Task GetBranchRequiredChecksAsync( + Provider provider, + string organizationName, + string repositoryName, + string branchName, + CancellationToken cancellationToken); +} diff --git a/Codacy.Api/Interfaces/IRepositoryToolPatternsApi.cs b/Codacy.Api/Interfaces/IRepositoryToolPatternsApi.cs new file mode 100644 index 0000000..730b266 --- /dev/null +++ b/Codacy.Api/Interfaces/IRepositoryToolPatternsApi.cs @@ -0,0 +1,100 @@ +using Codacy.Api.Models; +using Refit; + +namespace Codacy.Api.Interfaces; + +/// +/// Interface for repository tool pattern API operations +/// +public interface IRepositoryToolPatternsApi +{ + /// + /// List the patterns configuration for a repository tool + /// + /// + /// Uses the coding standard if applied, repository settings otherwise. + /// + [Get("/api/v3/analysis/organizations/{provider}/{organizationName}/repositories/{repositoryName}/tools/{toolUuid}/patterns")] + Task ListRepositoryToolPatternsAsync( + Provider provider, + string organizationName, + string repositoryName, + string toolUuid, + [Query] string? languages, + [Query] string? categories, + [Query] string? severityLevels, + [Query] string? tags, + [Query] string? search, + [Query] bool? enabled, + [Query] bool? recommended, + [Query] bool? matchesStack, + [Query] string? sort, + [Query] string? direction, + [Query] string? cursor, + [Query] int? limit, + CancellationToken cancellationToken); + + /// + /// Bulk update the code patterns of a tool in a repository + /// + /// + /// Use the filters to specify the code patterns to update, or omit them to update all code patterns. + /// + [Patch("/api/v3/analysis/organizations/{provider}/{organizationName}/repositories/{repositoryName}/tools/{toolUuid}/patterns")] + Task UpdateRepositoryToolPatternsAsync( + Provider provider, + string organizationName, + string repositoryName, + string toolUuid, + [Body] UpdateToolPatternsBody body, + [Query] string? languages, + [Query] string? categories, + [Query] string? severityLevels, + [Query] string? tags, + [Query] string? search, + [Query] bool? recommended, + [Query] bool? matchesStack, + CancellationToken cancellationToken); + + /// + /// Get the pattern configuration for a repository tool pattern + /// + [Get("/api/v3/analysis/organizations/{provider}/{organizationName}/repositories/{repositoryName}/tools/{toolUuid}/patterns/{patternId}")] + Task GetRepositoryToolPatternAsync( + Provider provider, + string organizationName, + string repositoryName, + string toolUuid, + string patternId, + CancellationToken cancellationToken); + + /// + /// Get the patterns overview for a repository tool + /// + [Get("/api/v3/analysis/organizations/{provider}/{organizationName}/repositories/{repositoryName}/tools/{toolUuid}/patterns/overview")] + Task GetToolPatternsOverviewAsync( + Provider provider, + string organizationName, + string repositoryName, + string toolUuid, + [Query] string? languages, + [Query] string? categories, + [Query] string? severityLevels, + [Query] string? tags, + [Query] string? search, + [Query] bool? enabled, + [Query] bool? recommended, + [Query] bool? matchesStack, + CancellationToken cancellationToken); + + /// + /// List the repository tool patterns that conflict with coding standards + /// + [Get("/api/v3/analysis/organizations/{provider}/{organizationName}/repositories/{repositoryName}/tools/{toolUuid}/conflicts")] + Task ListRepositoryToolPatternConflictsAsync( + Provider provider, + string organizationName, + string repositoryName, + string toolUuid, + CancellationToken cancellationToken); +} diff --git a/Codacy.Api/Interfaces/ISbomApi.cs b/Codacy.Api/Interfaces/ISbomApi.cs new file mode 100644 index 0000000..79e84f1 --- /dev/null +++ b/Codacy.Api/Interfaces/ISbomApi.cs @@ -0,0 +1,66 @@ +using Codacy.Api.Models; +using Refit; + +namespace Codacy.Api.Interfaces; + +/// +/// Interface for SBOM (software bill of materials) API operations +/// +public interface ISbomApi +{ + /// + /// Search the SBOM dependencies used across the organization + /// + /// + /// The body is non-nullable because Codacy rejects a null one. Pass an empty instance to search + /// unfiltered. sortColumn is severity (default) or ossfScore; columnOrder is + /// asc or desc (default). + /// + [Post("/api/v3/organizations/{provider}/{organizationName}/sbom/dependencies/search")] + Task SearchSbomDependenciesAsync( + Provider provider, + string organizationName, + [Body] SearchSbomDependenciesBody body, + [Query] string? cursor, + [Query] int? limit, + [Query] string? sortColumn, + [Query] string? columnOrder, + CancellationToken cancellationToken); + + /// + /// Search the repositories where a version of an SBOM dependency is used + /// + [Post("/api/v3/organizations/{provider}/{organizationName}/sbom/dependencies/repositories/search")] + Task SearchRepositoriesOfSbomDependencyAsync( + Provider provider, + string organizationName, + [Body] SearchRepositoriesOfSbomDependencyBody body, + [Query] string? cursor, + [Query] int? limit, + CancellationToken cancellationToken); + + /// + /// List repositories with SBOM dependency information + /// + /// + /// The body is non-nullable because Codacy rejects a null one. Pass an empty instance to search unfiltered. + /// + [Post("/api/v3/organizations/{provider}/{organizationName}/sbom/repositories/search")] + Task SearchSbomRepositoriesAsync( + Provider provider, + string organizationName, + [Body] SearchSbomRepositoriesBody body, + [Query] string? cursor, + [Query] int? limit, + CancellationToken cancellationToken); + + /// + /// Get a presigned URL for the latest SBOM of a repository + /// + [Get("/api/v3/organizations/{provider}/{organizationName}/projects/{repositoryName}/sbom")] + Task GetRepositorySbomPresignedUrlAsync( + Provider provider, + string organizationName, + string repositoryName, + CancellationToken cancellationToken); +} diff --git a/Codacy.Api/Interfaces/ISegmentsApi.cs b/Codacy.Api/Interfaces/ISegmentsApi.cs new file mode 100644 index 0000000..9528ef1 --- /dev/null +++ b/Codacy.Api/Interfaces/ISegmentsApi.cs @@ -0,0 +1,65 @@ +using Codacy.Api.Models; +using Refit; + +namespace Codacy.Api.Interfaces; + +/// +/// Interface for Segments API operations +/// +public interface ISegmentsApi +{ + /// + /// Get the status of the segments synchronization + /// + [Get("/api/v3/organizations/{provider}/{organizationName}/segments/sync")] + Task GetSegmentsSyncStatusAsync( + Provider provider, + string organizationName, + CancellationToken cancellationToken); + + /// + /// Synchronize the segments of the organization with the Git provider + /// + [Post("/api/v3/organizations/{provider}/{organizationName}/segments/sync")] + Task SyncSegmentsAsync( + Provider provider, + string organizationName, + CancellationToken cancellationToken); + + /// + /// Get the segment keys for the organization + /// + [Get("/api/v3/organizations/{provider}/{organizationName}/segments/keys")] + Task> GetSegmentsKeysAsync( + Provider provider, + string organizationName, + [Query] string? cursor, + [Query] int? limit, + [Query] string? search, + CancellationToken cancellationToken); + + /// + /// Get the segment keys with IDs for the organization + /// + [Get("/api/v3/organizations/{provider}/{organizationName}/segments/keys/ids")] + Task> GetSegmentsKeysWithIdsAsync( + Provider provider, + string organizationName, + [Query] string? cursor, + [Query] int? limit, + [Query] string? search, + CancellationToken cancellationToken); + + /// + /// Get the segment values for the organization by segment key + /// + [Get("/api/v3/organizations/{provider}/{organizationName}/segments/{segmentKey}/values")] + Task> GetSegmentsAsync( + Provider provider, + string organizationName, + string segmentKey, + [Query] string? cursor, + [Query] string? search, + [Query] int? limit, + CancellationToken cancellationToken); +} diff --git a/Codacy.Api/Interfaces/ISlackApi.cs b/Codacy.Api/Interfaces/ISlackApi.cs new file mode 100644 index 0000000..bd1b284 --- /dev/null +++ b/Codacy.Api/Interfaces/ISlackApi.cs @@ -0,0 +1,38 @@ +using Codacy.Api.Models; +using Refit; + +namespace Codacy.Api.Interfaces; + +/// +/// Interface for Slack integration API operations +/// +public interface ISlackApi +{ + /// + /// Get the Slack integration of the organization + /// + [Get("/api/v3/organizations/{provider}/{organizationName}/integrations/slack")] + Task GetSlackIntegrationAsync( + Provider provider, + string organizationName, + CancellationToken cancellationToken); + + /// + /// Create or update the Slack integration of the organization + /// + [Put("/api/v3/organizations/{provider}/{organizationName}/integrations/slack")] + Task CreateOrUpdateSlackIntegrationAsync( + Provider provider, + string organizationName, + [Body] SlackIntegrationRequest body, + CancellationToken cancellationToken); + + /// + /// Delete the Slack integration of the organization and associated resources + /// + [Delete("/api/v3/organizations/{provider}/{organizationName}/integrations/slack")] + Task DeleteSlackIntegrationAsync( + Provider provider, + string organizationName, + CancellationToken cancellationToken); +} diff --git a/Codacy.Api/Interfaces/IToolsApi.cs b/Codacy.Api/Interfaces/IToolsApi.cs new file mode 100644 index 0000000..d519702 --- /dev/null +++ b/Codacy.Api/Interfaces/IToolsApi.cs @@ -0,0 +1,72 @@ +using Codacy.Api.Models; +using Refit; + +namespace Codacy.Api.Interfaces; + +/// +/// Interface for tool and pattern catalogue API operations +/// +public interface IToolsApi +{ + /// + /// List the languages supported by available tools + /// + [Get("/api/v3/languages/tools")] + Task ListLanguagesWithToolsAsync( + CancellationToken cancellationToken); + + /// + /// List the tools + /// + [Get("/api/v3/tools")] + Task ListToolsAsync( + [Query] string? cursor, + [Query] int? limit, + CancellationToken cancellationToken); + + /// + /// List the patterns of a tool + /// + [Get("/api/v3/tools/{toolUuid}/patterns")] + Task ListPatternsAsync( + string toolUuid, + [Query] string? cursor, + [Query] int? limit, + [Query] bool? enabled, + CancellationToken cancellationToken); + + /// + /// Add feedback relating to a tool pattern + /// + [Post("/api/v3/tools/{toolUuid}/patterns/{patternId}/organizations/{provider}/{organizationName}/feedback")] + Task AddPatternFeedbackAsync( + string toolUuid, + string patternId, + Provider provider, + string organizationName, + [Body] AddEnrichedPatternFeedbackBody body, + CancellationToken cancellationToken); + + /// + /// Get a tool pattern + /// + [Get("/api/v3/tools/{toolUuid}/patterns/{patternId}")] + Task GetPatternAsync( + string toolUuid, + string patternId, + CancellationToken cancellationToken); + + /// + /// List the duplication tools + /// + [Get("/api/v3/duplicationTools")] + Task ListDuplicationToolsAsync( + CancellationToken cancellationToken); + + /// + /// List the metrics tools + /// + [Get("/api/v3/metricsTools")] + Task ListMetricsToolsAsync( + CancellationToken cancellationToken); +} diff --git a/Codacy.Api/Models/AddAutoconfigResponse.cs b/Codacy.Api/Models/AddAutoconfigResponse.cs new file mode 100644 index 0000000..9ff8aae --- /dev/null +++ b/Codacy.Api/Models/AddAutoconfigResponse.cs @@ -0,0 +1,19 @@ +namespace Codacy.Api.Models; + +/// +/// A response confirming the autoconfig run was accepted +/// +public class AddAutoconfigResponse +{ + /// Accepted run details + public required AddAutoconfigData Data { get; set; } +} + +/// +/// Details of an accepted autoconfig run +/// +public class AddAutoconfigData +{ + /// The autoconfig analysis id that was queued + public required Guid AnalysisId { get; set; } +} diff --git a/Codacy.Api/Models/AddEnrichedPatternFeedbackBody.cs b/Codacy.Api/Models/AddEnrichedPatternFeedbackBody.cs new file mode 100644 index 0000000..ba16864 --- /dev/null +++ b/Codacy.Api/Models/AddEnrichedPatternFeedbackBody.cs @@ -0,0 +1,13 @@ +namespace Codacy.Api.Models; + +/// +/// Feedback relating to an enriched tool pattern +/// +public class AddEnrichedPatternFeedbackBody +{ + /// True if the enriched pattern is considered good/relevant by the user + public required bool ReactionFeedback { get; set; } + + /// Feedback from the user describing why the enriched pattern is not considered good/relevant + public string? Feedback { get; set; } +} diff --git a/Codacy.Api/Models/AddEnterpriseAccountTokenBody.cs b/Codacy.Api/Models/AddEnterpriseAccountTokenBody.cs new file mode 100644 index 0000000..b5a019b --- /dev/null +++ b/Codacy.Api/Models/AddEnterpriseAccountTokenBody.cs @@ -0,0 +1,13 @@ +namespace Codacy.Api.Models; + +/// +/// Details of a new enterprise account token +/// +public class AddEnterpriseAccountTokenBody +{ + /// Token + public required string Token { get; set; } + + /// Git provider + public required Provider Provider { get; set; } +} diff --git a/Codacy.Api/Models/AddOrganizationBody.cs b/Codacy.Api/Models/AddOrganizationBody.cs new file mode 100644 index 0000000..e5c6afb --- /dev/null +++ b/Codacy.Api/Models/AddOrganizationBody.cs @@ -0,0 +1,22 @@ +namespace Codacy.Api.Models; + +/// +/// Request body to add an organization to Codacy +/// +public class AddOrganizationBody +{ + /// Git provider + public required Provider Provider { get; set; } + + /// Remote identifier + public required string RemoteIdentifier { get; set; } + + /// Organization name + public required string Name { get; set; } + + /// Organization type + public required OrganizationType Type { get; set; } + + /// Products + public List? Products { get; set; } +} diff --git a/Codacy.Api/Models/AddOrganizationResponse.cs b/Codacy.Api/Models/AddOrganizationResponse.cs new file mode 100644 index 0000000..33e15a6 --- /dev/null +++ b/Codacy.Api/Models/AddOrganizationResponse.cs @@ -0,0 +1,13 @@ +namespace Codacy.Api.Models; + +/// +/// Response of adding an organization +/// +public class AddOrganizationResponse +{ + /// Organization + public required Organization Organization { get; set; } + + /// Warnings + public List? Warnings { get; set; } +} diff --git a/Codacy.Api/Models/AdminEntity.cs b/Codacy.Api/Models/AdminEntity.cs new file mode 100644 index 0000000..3c6aa05 --- /dev/null +++ b/Codacy.Api/Models/AdminEntity.cs @@ -0,0 +1,28 @@ +namespace Codacy.Api.Models; + +/// +/// Admin entity +/// +public class AdminEntity +{ + /// Internal Codacy identifier for this entity + public required long Id { get; set; } + + /// Name to be used on URLs that identify the group for this type of entity + public required string GroupSlug { get; set; } + + /// Human friendly name + public required string DisplayName { get; set; } + + /// Entity details + public required Dictionary Details { get; set; } + + /// Related entities + public required List RelatedEntities { get; set; } + + /// Available resources + public required List AvailableResources { get; set; } + + /// Available actions + public required List AvailableActions { get; set; } +} diff --git a/Codacy.Api/Models/AdminEntityActionField.cs b/Codacy.Api/Models/AdminEntityActionField.cs new file mode 100644 index 0000000..0f11b2b --- /dev/null +++ b/Codacy.Api/Models/AdminEntityActionField.cs @@ -0,0 +1,34 @@ +namespace Codacy.Api.Models; + +/// +/// Field of an admin entity action +/// +public class AdminEntityActionField +{ + /// Field identifier used in the payload + public required string Name { get; set; } + + /// Human-friendly name for the field + public required string DisplayName { get; set; } + + /// Description of what the field controls + public string? Description { get; set; } + + /// Whether the field is required + public required bool Required { get; set; } + + /// The type of the field (boolean, number, string) + public required string FieldType { get; set; } + + /// Current value if fieldType is boolean + public bool? CurrentValueBoolean { get; set; } + + /// Current value if fieldType is number + public long? CurrentValueNumber { get; set; } + + /// Current value if fieldType is string + public string? CurrentValueString { get; set; } + + /// Additional metadata for the field + public Dictionary? Metadata { get; set; } +} diff --git a/Codacy.Api/Models/AdminEntityActionMetadata.cs b/Codacy.Api/Models/AdminEntityActionMetadata.cs new file mode 100644 index 0000000..e10c5c6 --- /dev/null +++ b/Codacy.Api/Models/AdminEntityActionMetadata.cs @@ -0,0 +1,22 @@ +namespace Codacy.Api.Models; + +/// +/// Admin entity action metadata +/// +public class AdminEntityActionMetadata +{ + /// Unique identifier for the action, used in URLs + public required string Slug { get; set; } + + /// Human-friendly name for the action + public required string DisplayName { get; set; } + + /// Description of what the action does + public string? Description { get; set; } + + /// Fields of the action + public required List Fields { get; set; } + + /// Whether the action requires user confirmation before execution + public required bool RequiresConfirmation { get; set; } +} diff --git a/Codacy.Api/Models/AdminEntityActionResponse.cs b/Codacy.Api/Models/AdminEntityActionResponse.cs new file mode 100644 index 0000000..c23df2a --- /dev/null +++ b/Codacy.Api/Models/AdminEntityActionResponse.cs @@ -0,0 +1,10 @@ +namespace Codacy.Api.Models; + +/// +/// Admin entity action response +/// +public class AdminEntityActionResponse +{ + /// Action result + public required AdminEntityActionResult Data { get; set; } +} diff --git a/Codacy.Api/Models/AdminEntityActionResult.cs b/Codacy.Api/Models/AdminEntityActionResult.cs new file mode 100644 index 0000000..b4d902c --- /dev/null +++ b/Codacy.Api/Models/AdminEntityActionResult.cs @@ -0,0 +1,19 @@ +namespace Codacy.Api.Models; + +/// +/// Admin entity action result +/// +public class AdminEntityActionResult +{ + /// Result type (success, updated, failed) + public required string ResultType { get; set; } + + /// Map of field names to their new values (for updated results) + public Dictionary? Changes { get; set; } + + /// Error message (for failed results) + public string? ErrorReason { get; set; } + + /// Entity identification + public AdminEntityIdentification? EntityIdentification { get; set; } +} diff --git a/Codacy.Api/Models/AdminEntityGroup.cs b/Codacy.Api/Models/AdminEntityGroup.cs new file mode 100644 index 0000000..853c437 --- /dev/null +++ b/Codacy.Api/Models/AdminEntityGroup.cs @@ -0,0 +1,13 @@ +namespace Codacy.Api.Models; + +/// +/// Admin entity group +/// +public class AdminEntityGroup +{ + /// Name to be used on URLs that identify the group for this type of entity + public required string Slug { get; set; } + + /// Entities in the group + public required List Items { get; set; } +} diff --git a/Codacy.Api/Models/AdminEntityGroupResponse.cs b/Codacy.Api/Models/AdminEntityGroupResponse.cs new file mode 100644 index 0000000..bc50bdc --- /dev/null +++ b/Codacy.Api/Models/AdminEntityGroupResponse.cs @@ -0,0 +1,10 @@ +namespace Codacy.Api.Models; + +/// +/// Admin entity group response +/// +public class AdminEntityGroupResponse +{ + /// Entity groups + public required List Data { get; set; } +} diff --git a/Codacy.Api/Models/AdminEntityIdentification.cs b/Codacy.Api/Models/AdminEntityIdentification.cs new file mode 100644 index 0000000..fa8fc4c --- /dev/null +++ b/Codacy.Api/Models/AdminEntityIdentification.cs @@ -0,0 +1,13 @@ +namespace Codacy.Api.Models; + +/// +/// Admin entity identification +/// +public class AdminEntityIdentification +{ + /// Internal Codacy identifier for this entity + public required long Id { get; set; } + + /// Name to be used on URLs that identify the group for this type of entity + public required string GroupSlug { get; set; } +} diff --git a/Codacy.Api/Models/AdminEntityResource.cs b/Codacy.Api/Models/AdminEntityResource.cs new file mode 100644 index 0000000..e47ec93 --- /dev/null +++ b/Codacy.Api/Models/AdminEntityResource.cs @@ -0,0 +1,13 @@ +namespace Codacy.Api.Models; + +/// +/// Admin entity resource +/// +public class AdminEntityResource +{ + /// Resource details + public required Dictionary Details { get; set; } + + /// Entity identification + public AdminEntityIdentification? EntityIdentification { get; set; } +} diff --git a/Codacy.Api/Models/AdminEntityResponse.cs b/Codacy.Api/Models/AdminEntityResponse.cs new file mode 100644 index 0000000..4f3f84c --- /dev/null +++ b/Codacy.Api/Models/AdminEntityResponse.cs @@ -0,0 +1,10 @@ +namespace Codacy.Api.Models; + +/// +/// Admin entity response +/// +public class AdminEntityResponse +{ + /// Admin entity + public required AdminEntity Data { get; set; } +} diff --git a/Codacy.Api/Models/AiInventoryFilter.cs b/Codacy.Api/Models/AiInventoryFilter.cs new file mode 100644 index 0000000..568dc70 --- /dev/null +++ b/Codacy.Api/Models/AiInventoryFilter.cs @@ -0,0 +1,28 @@ +namespace Codacy.Api.Models; + +/// +/// Common filters for AI inventory queries +/// +public class AiInventoryFilter +{ + /// Inventory item types to filter by (for example tool, asset) + public List? InventoryItemTypes { get; set; } + + /// AI provider name to filter by + public string? AiProvider { get; set; } + + /// Segment IDs to filter by + public List? Segments { get; set; } + + /// Repository names to filter by + public List? Repositories { get; set; } + + /// Inventory category groups to filter by (for example workflows, usage, mcps) + public List? CategoryGroups { get; set; } + + /// Inventory categories to filter by (for example code_marker, commits) + public List? Categories { get; set; } + + /// Marker text to filter by + public string? Marker { get; set; } +} diff --git a/Codacy.Api/Models/AiInventoryLocationSummary.cs b/Codacy.Api/Models/AiInventoryLocationSummary.cs new file mode 100644 index 0000000..782c3cb --- /dev/null +++ b/Codacy.Api/Models/AiInventoryLocationSummary.cs @@ -0,0 +1,13 @@ +namespace Codacy.Api.Models; + +/// +/// Summary for a distinct location where an AI inventory item is referenced +/// +public class AiInventoryLocationSummary +{ + /// Location URI (for example repo-file:src/somefile.py) + public required string Location { get; set; } + + /// Region URIs within the location (for example line:10); may be empty + public required List Regions { get; set; } +} diff --git a/Codacy.Api/Models/AiInventoryMarkerSummary.cs b/Codacy.Api/Models/AiInventoryMarkerSummary.cs new file mode 100644 index 0000000..7433087 --- /dev/null +++ b/Codacy.Api/Models/AiInventoryMarkerSummary.cs @@ -0,0 +1,22 @@ +namespace Codacy.Api.Models; + +/// +/// Summary for a distinct inventory resource (category group, category, marker) +/// +public class AiInventoryMarkerSummary +{ + /// Category group the marker belongs to + public required string CategoryGroup { get; set; } + + /// Category the marker belongs to within its group + public required string Category { get; set; } + + /// Marker text identifying the inventory item + public required string Marker { get; set; } + + /// Total number of references for this marker + public required int ReferencesCount { get; set; } + + /// Number of distinct repositories containing this marker + public required int RepositoriesCount { get; set; } +} diff --git a/Codacy.Api/Models/AiInventoryProviderSummary.cs b/Codacy.Api/Models/AiInventoryProviderSummary.cs new file mode 100644 index 0000000..b2009b9 --- /dev/null +++ b/Codacy.Api/Models/AiInventoryProviderSummary.cs @@ -0,0 +1,22 @@ +namespace Codacy.Api.Models; + +/// +/// Summary of AI inventory for a provider +/// +public class AiInventoryProviderSummary +{ + /// AI provider name + public required string AiProvider { get; set; } + + /// Number of distinct inventory resources for this provider + public required int ResourcesCount { get; set; } + + /// Total number of inventory item references for this provider + public required int ReferencesCount { get; set; } + + /// Number of distinct repositories where items for this provider occur + public required int RepositoriesCount { get; set; } + + /// Per-category-group repository counts + public required List CategoryGroupBreakdown { get; set; } +} diff --git a/Codacy.Api/Models/AiInventoryProviderSummaryResponse.cs b/Codacy.Api/Models/AiInventoryProviderSummaryResponse.cs new file mode 100644 index 0000000..d5ae33d --- /dev/null +++ b/Codacy.Api/Models/AiInventoryProviderSummaryResponse.cs @@ -0,0 +1,10 @@ +namespace Codacy.Api.Models; + +/// +/// Response containing the summary for one AI provider +/// +public class AiInventoryProviderSummaryResponse +{ + /// The provider summary + public required AiInventoryProviderSummary Data { get; set; } +} diff --git a/Codacy.Api/Models/AiInventoryRepositoryInfo.cs b/Codacy.Api/Models/AiInventoryRepositoryInfo.cs new file mode 100644 index 0000000..d1e2131 --- /dev/null +++ b/Codacy.Api/Models/AiInventoryRepositoryInfo.cs @@ -0,0 +1,13 @@ +namespace Codacy.Api.Models; + +/// +/// A repository that has AI inventory items +/// +public class AiInventoryRepositoryInfo +{ + /// Name of the repository + public required string Name { get; set; } + + /// Owner of the repository + public required string Owner { get; set; } +} diff --git a/Codacy.Api/Models/AiInventoryRepositorySummary.cs b/Codacy.Api/Models/AiInventoryRepositorySummary.cs new file mode 100644 index 0000000..ad117d0 --- /dev/null +++ b/Codacy.Api/Models/AiInventoryRepositorySummary.cs @@ -0,0 +1,16 @@ +namespace Codacy.Api.Models; + +/// +/// Summary of AI inventory for a repository +/// +public class AiInventoryRepositorySummary +{ + /// Name of the repository + public required string RepositoryName { get; set; } + + /// Number of distinct locations with matching inventory items + public required int LocationsCount { get; set; } + + /// Total number of inventory item references in this repository + public required int ReferencesCount { get; set; } +} diff --git a/Codacy.Api/Models/AiRiskCheckListItem.cs b/Codacy.Api/Models/AiRiskCheckListItem.cs new file mode 100644 index 0000000..d025504 --- /dev/null +++ b/Codacy.Api/Models/AiRiskCheckListItem.cs @@ -0,0 +1,22 @@ +namespace Codacy.Api.Models; + +/// +/// An item in the AI Risk Checklist +/// +public class AiRiskCheckListItem +{ + /// The key identifier for the checklist item + public required string Key { get; set; } + + /// Checks if the checklist item passes + public required bool Check { get; set; } + + /// The number of repositories that have the AI policy applied + public int? Number { get; set; } + + /// The minimum percentage of repositories required to meet the AI policy compliance + public int? Threshold { get; set; } + + /// The total number of repositories + public int? Total { get; set; } +} diff --git a/Codacy.Api/Models/AiRiskChecklistResponse.cs b/Codacy.Api/Models/AiRiskChecklistResponse.cs new file mode 100644 index 0000000..487b4e8 --- /dev/null +++ b/Codacy.Api/Models/AiRiskChecklistResponse.cs @@ -0,0 +1,10 @@ +namespace Codacy.Api.Models; + +/// +/// AI Risk Checklist for an organization +/// +public class AiRiskChecklistResponse +{ + /// Checklist items + public required List Data { get; set; } +} diff --git a/Codacy.Api/Models/AnalyzeDastTargetResponse.cs b/Codacy.Api/Models/AnalyzeDastTargetResponse.cs new file mode 100644 index 0000000..f6669e1 --- /dev/null +++ b/Codacy.Api/Models/AnalyzeDastTargetResponse.cs @@ -0,0 +1,10 @@ +namespace Codacy.Api.Models; + +/// +/// A response with the analysis ID that was queued +/// +public class AnalyzeDastTargetResponse +{ + /// The queued analysis + public required AnalyzeDastTargetResult Data { get; set; } +} diff --git a/Codacy.Api/Models/AnalyzeDastTargetResult.cs b/Codacy.Api/Models/AnalyzeDastTargetResult.cs new file mode 100644 index 0000000..67304b5 --- /dev/null +++ b/Codacy.Api/Models/AnalyzeDastTargetResult.cs @@ -0,0 +1,10 @@ +namespace Codacy.Api.Models; + +/// +/// The queued DAST analysis +/// +public class AnalyzeDastTargetResult +{ + /// The identifier of the queued analysis + public required Guid AnalysisId { get; set; } +} diff --git a/Codacy.Api/Models/ApiTokenResponse.cs b/Codacy.Api/Models/ApiTokenResponse.cs new file mode 100644 index 0000000..1332974 --- /dev/null +++ b/Codacy.Api/Models/ApiTokenResponse.cs @@ -0,0 +1,10 @@ +namespace Codacy.Api.Models; + +/// +/// API token response +/// +public class ApiTokenResponse +{ + /// The API token + public required ApiToken Data { get; set; } +} diff --git a/Codacy.Api/Models/ApplyGatePolicyToRepositoriesBody.cs b/Codacy.Api/Models/ApplyGatePolicyToRepositoriesBody.cs new file mode 100644 index 0000000..98d345a --- /dev/null +++ b/Codacy.Api/Models/ApplyGatePolicyToRepositoriesBody.cs @@ -0,0 +1,13 @@ +namespace Codacy.Api.Models; + +/// +/// Names of the repositories to link or unlink from a gate policy +/// +public class ApplyGatePolicyToRepositoriesBody +{ + /// Names of the repositories to link to a gate policy + public required List Link { get; set; } + + /// Names of the repositories to unlink from a gate policy + public required List Unlink { get; set; } +} diff --git a/Codacy.Api/Models/AuditActor.cs b/Codacy.Api/Models/AuditActor.cs new file mode 100644 index 0000000..10ca535 --- /dev/null +++ b/Codacy.Api/Models/AuditActor.cs @@ -0,0 +1,13 @@ +namespace Codacy.Api.Models; + +/// +/// Actor of the audit event +/// +public class AuditActor +{ + /// Email of the audit actor + public required string Email { get; set; } + + /// Role of the audit actor + public AuditActorRole? Role { get; set; } +} diff --git a/Codacy.Api/Models/AuditActorRole.cs b/Codacy.Api/Models/AuditActorRole.cs new file mode 100644 index 0000000..4ecc239 --- /dev/null +++ b/Codacy.Api/Models/AuditActorRole.cs @@ -0,0 +1,34 @@ +using System.Text.Json.Serialization; + +namespace Codacy.Api.Models; + +/// +/// Role of the audit actor +/// +[JsonConverter(typeof(JsonStringEnumConverter))] +public enum AuditActorRole +{ + /// Repository read + [JsonStringEnumMemberName("repositoryRead")] + RepositoryRead, + + /// Repository write + [JsonStringEnumMemberName("repositoryWrite")] + RepositoryWrite, + + /// Repository admin + [JsonStringEnumMemberName("repositoryAdmin")] + RepositoryAdmin, + + /// Organization member + [JsonStringEnumMemberName("organizationMember")] + OrganizationMember, + + /// Organization manager + [JsonStringEnumMemberName("organizationManager")] + OrganizationManager, + + /// Organization admin + [JsonStringEnumMemberName("organizationAdmin")] + OrganizationAdmin +} diff --git a/Codacy.Api/Models/AuditLog.cs b/Codacy.Api/Models/AuditLog.cs new file mode 100644 index 0000000..b564a7b --- /dev/null +++ b/Codacy.Api/Models/AuditLog.cs @@ -0,0 +1,36 @@ +using System.Text.Json; + +namespace Codacy.Api.Models; + +/// +/// Audit log of an event performed by a Codacy user who is part of an organization +/// +public class AuditLog +{ + /// Actor of the event + public required AuditActor Actor { get; set; } + + /// Action performed in the event + public required string Action { get; set; } + + /// Result of the audit action + public required AuditResultType Result { get; set; } + + /// Timestamp when the event occurred + public required DateTimeOffset Timestamp { get; set; } + + /// Source of the event: UI (Codacy app) or API (Codacy API) + public string? Source { get; set; } + + /// Name of the repository, if the scope of the event action is a repository + public string? RepositoryName { get; set; } + + /// Description of the event + public string? Description { get; set; } + + /// Free-form details specific to the performed event action (JsonElement because the spec leaves the shape open) + public JsonElement? Details { get; set; } + + /// Identifier of the entity involved in the event + public string? EntityId { get; set; } +} diff --git a/Codacy.Api/Models/AuditResultType.cs b/Codacy.Api/Models/AuditResultType.cs new file mode 100644 index 0000000..117ea7e --- /dev/null +++ b/Codacy.Api/Models/AuditResultType.cs @@ -0,0 +1,22 @@ +using System.Text.Json.Serialization; + +namespace Codacy.Api.Models; + +/// +/// Result of the audit action +/// +[JsonConverter(typeof(JsonStringEnumConverter))] +public enum AuditResultType +{ + /// Succeeded + [JsonStringEnumMemberName("succeed")] + Succeed, + + /// Failed + [JsonStringEnumMemberName("failed")] + Failed, + + /// Rejected + [JsonStringEnumMemberName("rejected")] + Rejected +} diff --git a/Codacy.Api/Models/AutoconfigBeforeAfter.cs b/Codacy.Api/Models/AutoconfigBeforeAfter.cs new file mode 100644 index 0000000..9619e33 --- /dev/null +++ b/Codacy.Api/Models/AutoconfigBeforeAfter.cs @@ -0,0 +1,13 @@ +namespace Codacy.Api.Models; + +/// +/// A before/after count pair for a metric impacted by an autoconfig run +/// +public class AutoconfigBeforeAfter +{ + /// Value before the run + public required int Before { get; set; } + + /// Value after the run + public required int After { get; set; } +} diff --git a/Codacy.Api/Models/AutoconfigConflict.cs b/Codacy.Api/Models/AutoconfigConflict.cs new file mode 100644 index 0000000..a11a170 --- /dev/null +++ b/Codacy.Api/Models/AutoconfigConflict.cs @@ -0,0 +1,22 @@ +namespace Codacy.Api.Models; + +/// +/// A change skipped due to a conflict with an existing coding standard +/// +public class AutoconfigConflict +{ + /// Pattern identifier + public string? PatternId { get; set; } + + /// Name of the tool the pattern belongs to + public required string ToolName { get; set; } + + /// Conflict type + public required string Conflict { get; set; } + + /// Name of the coding standard that caused the conflict + public string? CodingStandardName { get; set; } + + /// Explanation of why the change was skipped + public required string Reason { get; set; } +} diff --git a/Codacy.Api/Models/AutoconfigParameterChange.cs b/Codacy.Api/Models/AutoconfigParameterChange.cs new file mode 100644 index 0000000..28f83f8 --- /dev/null +++ b/Codacy.Api/Models/AutoconfigParameterChange.cs @@ -0,0 +1,16 @@ +namespace Codacy.Api.Models; + +/// +/// A parameter value that changed as part of an autoconfig pattern update +/// +public class AutoconfigParameterChange +{ + /// Parameter identifier + public required string Id { get; set; } + + /// Value before the change + public required string Before { get; set; } + + /// Value after the change + public required string After { get; set; } +} diff --git a/Codacy.Api/Models/AutoconfigPatternChange.cs b/Codacy.Api/Models/AutoconfigPatternChange.cs new file mode 100644 index 0000000..6bb7e0b --- /dev/null +++ b/Codacy.Api/Models/AutoconfigPatternChange.cs @@ -0,0 +1,25 @@ +namespace Codacy.Api.Models; + +/// +/// A pattern that was enabled, disabled, or updated by an autoconfig run +/// +public class AutoconfigPatternChange +{ + /// Pattern identifier + public required string PatternId { get; set; } + + /// Name of the tool the pattern belongs to + public required string ToolName { get; set; } + + /// Whether the pattern was enabled, disabled, or updated + public required string Action { get; set; } + + /// Reason for the change + public required string Reason { get; set; } + + /// Net change in issue count caused by this pattern change + public required int DeltaIssues { get; set; } + + /// Parameter values that changed + public required List Parameters { get; set; } +} diff --git a/Codacy.Api/Models/AutoconfigRecommendedPath.cs b/Codacy.Api/Models/AutoconfigRecommendedPath.cs new file mode 100644 index 0000000..7f0c81a --- /dev/null +++ b/Codacy.Api/Models/AutoconfigRecommendedPath.cs @@ -0,0 +1,13 @@ +namespace Codacy.Api.Models; + +/// +/// A path recommended to be added to the repository ignore list +/// +public class AutoconfigRecommendedPath +{ + /// The path to ignore + public required string Path { get; set; } + + /// Reason the path is recommended for ignoring + public required string Reason { get; set; } +} diff --git a/Codacy.Api/Models/AutoconfigRunSummary.cs b/Codacy.Api/Models/AutoconfigRunSummary.cs new file mode 100644 index 0000000..8445877 --- /dev/null +++ b/Codacy.Api/Models/AutoconfigRunSummary.cs @@ -0,0 +1,61 @@ +namespace Codacy.Api.Models; + +/// +/// Summary of a completed autoconfig run +/// +public class AutoconfigRunSummary +{ + /// The autoconfig analysis ID + public required Guid AnalysisId { get; set; } + + /// Repository identifier + public required long RepositoryId { get; set; } + + /// Total duration of the run in milliseconds + public required long DurationMs { get; set; } + + /// Number of issues found before autoconfig was applied + public int? IssuesBefore { get; set; } + + /// Number of issues found after autoconfig was applied + public int? IssuesAfter { get; set; } + + /// Number of languages detected in the repository + public int? LanguageCount { get; set; } + + /// Number of files analysed + public int? FileCount { get; set; } + + /// Number of patterns enabled before and after this run + public AutoconfigBeforeAfter? EnabledPatterns { get; set; } + + /// Number of tools enabled before and after this run + public AutoconfigBeforeAfter? EnabledTools { get; set; } + + /// Issue counts grouped by category, before and after this run + public Dictionary? IssuesByCategory { get; set; } + + /// Issue counts grouped by severity, before and after this run + public Dictionary? IssuesBySeverity { get; set; } + + /// Paths recommended to be added to the ignore list + public List? RecommendedPathsToIgnore { get; set; } + + /// Human-readable highlights of the most impactful changes made by this run + public List? KeyImprovements { get; set; } + + /// When the run started + public required DateTimeOffset StartedAt { get; set; } + + /// When the run completed + public required DateTimeOffset CompletedAt { get; set; } + + /// Tools that were enabled or disabled by this run + public List? ToolChanges { get; set; } + + /// Patterns that were enabled, disabled, or updated by this run + public List? PatternChanges { get; set; } + + /// Changes skipped due to conflicts with existing coding standards + public List? Conflicts { get; set; } +} diff --git a/Codacy.Api/Models/AutoconfigRunSummaryResponse.cs b/Codacy.Api/Models/AutoconfigRunSummaryResponse.cs new file mode 100644 index 0000000..91d2b0f --- /dev/null +++ b/Codacy.Api/Models/AutoconfigRunSummaryResponse.cs @@ -0,0 +1,10 @@ +namespace Codacy.Api.Models; + +/// +/// The latest autoconfig run summary for a repository +/// +public class AutoconfigRunSummaryResponse +{ + /// Run summary + public required AutoconfigRunSummary Data { get; set; } +} diff --git a/Codacy.Api/Models/AutoconfigStatus.cs b/Codacy.Api/Models/AutoconfigStatus.cs new file mode 100644 index 0000000..36a596f --- /dev/null +++ b/Codacy.Api/Models/AutoconfigStatus.cs @@ -0,0 +1,26 @@ +using System.Text.Json.Serialization; + +namespace Codacy.Api.Models; + +/// +/// Autoconfig analysis status +/// +[JsonConverter(typeof(JsonStringEnumConverter))] +public enum AutoconfigStatus +{ + /// Queued + [JsonStringEnumMemberName("queued")] + Queued, + + /// Running + [JsonStringEnumMemberName("running")] + Running, + + /// Successful + [JsonStringEnumMemberName("successful")] + Successful, + + /// Failed + [JsonStringEnumMemberName("failed")] + Failed +} diff --git a/Codacy.Api/Models/AutoconfigStatusResponse.cs b/Codacy.Api/Models/AutoconfigStatusResponse.cs new file mode 100644 index 0000000..bc4104a --- /dev/null +++ b/Codacy.Api/Models/AutoconfigStatusResponse.cs @@ -0,0 +1,28 @@ +namespace Codacy.Api.Models; + +/// +/// The latest autoconfig run status for the repository +/// +public class AutoconfigStatusResponse +{ + /// Status details + public required AutoconfigStatusData Data { get; set; } +} + +/// +/// Autoconfig run status details +/// +public class AutoconfigStatusData +{ + /// The current autoconfig analysis status of a repository + public required AutoconfigStatus Status { get; set; } + + /// When the repository transitioned to this status + public required DateTimeOffset TransitionedAt { get; set; } + + /// An optional description of why the repository transitioned to the current status + public string? TransitionReason { get; set; } + + /// The autoconfig analysis id associated with this status + public required Guid AnalysisId { get; set; } +} diff --git a/Codacy.Api/Models/AutoconfigToolChange.cs b/Codacy.Api/Models/AutoconfigToolChange.cs new file mode 100644 index 0000000..7159b23 --- /dev/null +++ b/Codacy.Api/Models/AutoconfigToolChange.cs @@ -0,0 +1,19 @@ +namespace Codacy.Api.Models; + +/// +/// A tool that was enabled or disabled by an autoconfig run +/// +public class AutoconfigToolChange +{ + /// Name of the tool + public required string ToolName { get; set; } + + /// Whether the tool was enabled or disabled + public required string Action { get; set; } + + /// Reason for the change + public required string Reason { get; set; } + + /// Number of patterns affected by this tool change + public required int PatternsAffected { get; set; } +} diff --git a/Codacy.Api/Models/AvailableJiraProjectsResponse.cs b/Codacy.Api/Models/AvailableJiraProjectsResponse.cs new file mode 100644 index 0000000..1965085 --- /dev/null +++ b/Codacy.Api/Models/AvailableJiraProjectsResponse.cs @@ -0,0 +1,13 @@ +namespace Codacy.Api.Models; + +/// +/// A response with a list of available Jira projects +/// +public class AvailableJiraProjectsResponse +{ + /// The projects + public required List Data { get; set; } + + /// Pagination info + public PaginationInfoLong? Pagination { get; set; } +} diff --git a/Codacy.Api/Models/BillingDetailsUpdate.cs b/Codacy.Api/Models/BillingDetailsUpdate.cs new file mode 100644 index 0000000..863a4d4 --- /dev/null +++ b/Codacy.Api/Models/BillingDetailsUpdate.cs @@ -0,0 +1,31 @@ +namespace Codacy.Api.Models; + +/// +/// Billing details update +/// +public class BillingDetailsUpdate +{ + /// First name + public required string FirstName { get; set; } + + /// Last name + public required string LastName { get; set; } + + /// Billing email + public required string BillingEmail { get; set; } + + /// Country + public required string Country { get; set; } + + /// VAT number + public required string Vat { get; set; } + + /// Address + public required string Address { get; set; } + + /// Zip or postal code + public required string Zip { get; set; } + + /// State + public required string State { get; set; } +} diff --git a/Codacy.Api/Models/BillingEstimation.cs b/Codacy.Api/Models/BillingEstimation.cs new file mode 100644 index 0000000..b709509 --- /dev/null +++ b/Codacy.Api/Models/BillingEstimation.cs @@ -0,0 +1,31 @@ +namespace Codacy.Api.Models; + +/// +/// Billing estimation +/// +public class BillingEstimation +{ + /// Price per seat in cents + public required int PerSeatCents { get; set; } + + /// Number of seats + public required int Seats { get; set; } + + /// Taxes + public required List Taxes { get; set; } + + /// Discount in cents + public int? DiscountCents { get; set; } + + /// Subtotal in cents + public required long SubTotalCents { get; set; } + + /// Total in cents + public required long TotalCents { get; set; } + + /// Next billing date + public required DateTimeOffset NextBilling { get; set; } + + /// Whether billing is monthly + public required bool IsMonthly { get; set; } +} diff --git a/Codacy.Api/Models/BillingEstimationResponse.cs b/Codacy.Api/Models/BillingEstimationResponse.cs new file mode 100644 index 0000000..2b0bc58 --- /dev/null +++ b/Codacy.Api/Models/BillingEstimationResponse.cs @@ -0,0 +1,10 @@ +namespace Codacy.Api.Models; + +/// +/// Billing estimation response +/// +public class BillingEstimationResponse +{ + /// Billing estimation + public required BillingEstimation Data { get; set; } +} diff --git a/Codacy.Api/Models/BranchRequiredChecks.cs b/Codacy.Api/Models/BranchRequiredChecks.cs new file mode 100644 index 0000000..7155418 --- /dev/null +++ b/Codacy.Api/Models/BranchRequiredChecks.cs @@ -0,0 +1,16 @@ +namespace Codacy.Api.Models; + +/// +/// Codacy checks required before merge on a branch +/// +public class BranchRequiredChecks +{ + /// True if the branch requires the Codacy Static Code Analysis step before merge + public required bool Quality { get; set; } + + /// True if the branch requires the Codacy Diff Coverage step before merge + public required bool DiffCoverage { get; set; } + + /// True if the branch requires the Codacy Coverage Variation step before merge + public required bool CoverageVariation { get; set; } +} diff --git a/Codacy.Api/Models/BranchRequiredChecksResponse.cs b/Codacy.Api/Models/BranchRequiredChecksResponse.cs new file mode 100644 index 0000000..daaf5d5 --- /dev/null +++ b/Codacy.Api/Models/BranchRequiredChecksResponse.cs @@ -0,0 +1,10 @@ +namespace Codacy.Api.Models; + +/// +/// Branch required checks response +/// +public class BranchRequiredChecksResponse +{ + /// Required checks + public required BranchRequiredChecks Data { get; set; } +} diff --git a/Codacy.Api/Models/BuildServerAnalysisSettingRequest.cs b/Codacy.Api/Models/BuildServerAnalysisSettingRequest.cs new file mode 100644 index 0000000..a8cbd76 --- /dev/null +++ b/Codacy.Api/Models/BuildServerAnalysisSettingRequest.cs @@ -0,0 +1,10 @@ +namespace Codacy.Api.Models; + +/// +/// New value for the repository setting Run analysis on your build server +/// +public class BuildServerAnalysisSettingRequest +{ + /// If true, Codacy waits for the build server to upload local analysis results; if false, Codacy analyzes commits on its cloud infrastructure + public required bool BuildServerAnalysisSetting { get; set; } +} diff --git a/Codacy.Api/Models/BuildServerAnalysisSettingResponse.cs b/Codacy.Api/Models/BuildServerAnalysisSettingResponse.cs new file mode 100644 index 0000000..4ba3e02 --- /dev/null +++ b/Codacy.Api/Models/BuildServerAnalysisSettingResponse.cs @@ -0,0 +1,10 @@ +namespace Codacy.Api.Models; + +/// +/// Status of the repository setting Run analysis on your build server +/// +public class BuildServerAnalysisSettingResponse +{ + /// If true, Codacy waits for the build server to upload local analysis results; if false, Codacy analyzes commits on its cloud infrastructure + public required bool BuildServerAnalysisSetting { get; set; } +} diff --git a/Codacy.Api/Models/Card.cs b/Codacy.Api/Models/Card.cs new file mode 100644 index 0000000..934760f --- /dev/null +++ b/Codacy.Api/Models/Card.cs @@ -0,0 +1,22 @@ +namespace Codacy.Api.Models; + +/// +/// Payment card information +/// +public class Card +{ + /// Masked card number + public required string MaskedNumber { get; set; } + + /// Last four digits + public required string Last4 { get; set; } + + /// Expiry month + public required int ExpiryMonth { get; set; } + + /// Expiry year + public required int ExpiryYear { get; set; } + + /// Card holder name + public required string HolderName { get; set; } +} diff --git a/Codacy.Api/Models/CardCreation.cs b/Codacy.Api/Models/CardCreation.cs new file mode 100644 index 0000000..6362f06 --- /dev/null +++ b/Codacy.Api/Models/CardCreation.cs @@ -0,0 +1,10 @@ +namespace Codacy.Api.Models; + +/// +/// Request body to add a card +/// +public class CardCreation +{ + /// Card token + public required string CardToken { get; set; } +} diff --git a/Codacy.Api/Models/CardResponse.cs b/Codacy.Api/Models/CardResponse.cs new file mode 100644 index 0000000..b7188ff --- /dev/null +++ b/Codacy.Api/Models/CardResponse.cs @@ -0,0 +1,10 @@ +namespace Codacy.Api.Models; + +/// +/// Card response +/// +public class CardResponse +{ + /// Card information + public Card? Data { get; set; } +} diff --git a/Codacy.Api/Models/CategoryGroupCount.cs b/Codacy.Api/Models/CategoryGroupCount.cs new file mode 100644 index 0000000..84c769b --- /dev/null +++ b/Codacy.Api/Models/CategoryGroupCount.cs @@ -0,0 +1,16 @@ +namespace Codacy.Api.Models; + +/// +/// Counts for a given category group +/// +public class CategoryGroupCount +{ + /// Inventory category group + public required string CategoryGroup { get; set; } + + /// Number of distinct repositories with items in this category group + public int? RepositoriesCount { get; set; } + + /// Number of distinct (category, marker) pairs in this category group + public required int Count { get; set; } +} diff --git a/Codacy.Api/Models/ChangePlan.cs b/Codacy.Api/Models/ChangePlan.cs new file mode 100644 index 0000000..ed429f0 --- /dev/null +++ b/Codacy.Api/Models/ChangePlan.cs @@ -0,0 +1,13 @@ +namespace Codacy.Api.Models; + +/// +/// Request body to change the plan of an organization +/// +public class ChangePlan +{ + /// The code that uniquely identifies the payment plan + public required string Code { get; set; } + + /// Promotional code + public string? PromoCode { get; set; } +} diff --git a/Codacy.Api/Models/CheckSubmodulesResponse.cs b/Codacy.Api/Models/CheckSubmodulesResponse.cs new file mode 100644 index 0000000..338c3bf --- /dev/null +++ b/Codacy.Api/Models/CheckSubmodulesResponse.cs @@ -0,0 +1,10 @@ +namespace Codacy.Api.Models; + +/// +/// Check submodules response +/// +public class CheckSubmodulesResponse +{ + /// True if the submodules option is enabled for the organization + public required bool Data { get; set; } +} diff --git a/Codacy.Api/Models/ChurnFeedback.cs b/Codacy.Api/Models/ChurnFeedback.cs new file mode 100644 index 0000000..7802f0d --- /dev/null +++ b/Codacy.Api/Models/ChurnFeedback.cs @@ -0,0 +1,13 @@ +namespace Codacy.Api.Models; + +/// +/// Feedback when deleting a subscription +/// +public class ChurnFeedback +{ + /// Reason for joining + public required Reason JoinReason { get; set; } + + /// Reason for cancelling + public required Reason CancelReason { get; set; } +} diff --git a/Codacy.Api/Models/CloneDuplicationBlock.cs b/Codacy.Api/Models/CloneDuplicationBlock.cs new file mode 100644 index 0000000..fec0723 --- /dev/null +++ b/Codacy.Api/Models/CloneDuplicationBlock.cs @@ -0,0 +1,22 @@ +namespace Codacy.Api.Models; + +/// +/// Occurrence of a duplicated code block +/// +public class CloneDuplicationBlock +{ + /// Path of the file + public required string Path { get; set; } + + /// File ID + public required long FileId { get; set; } + + /// File data ID + public required long FileDataId { get; set; } + + /// First line of the block + public required long FromLine { get; set; } + + /// Last line of the block + public required long ToLine { get; set; } +} diff --git a/Codacy.Api/Models/CodacyPaymentPlans.cs b/Codacy.Api/Models/CodacyPaymentPlans.cs new file mode 100644 index 0000000..df58cf3 --- /dev/null +++ b/Codacy.Api/Models/CodacyPaymentPlans.cs @@ -0,0 +1,34 @@ +namespace Codacy.Api.Models; + +/// +/// Available payment plans +/// +public class CodacyPaymentPlans +{ + /// Default yearly paid plan code + public required string DefaultYearlyPaidCode { get; set; } + + /// Default monthly paid plan code + public required string DefaultMonthlyPaidCode { get; set; } + + /// Trial plan code + public required string TrialCode { get; set; } + + /// Open source plan code + public required string OpenSourceCode { get; set; } + + /// Default yearly paid plan + public required PaymentPlan DefaultYearlyPaidPlan { get; set; } + + /// Default monthly paid plan + public required PaymentPlan DefaultMonthlyPaidPlan { get; set; } + + /// Trial plan + public required PaymentPlan TrialPlan { get; set; } + + /// Open source plan + public required PaymentPlan OpenSourcePlan { get; set; } + + /// All plans + public required List Plans { get; set; } +} diff --git a/Codacy.Api/Models/CodacyProduct.cs b/Codacy.Api/Models/CodacyProduct.cs new file mode 100644 index 0000000..de362cf --- /dev/null +++ b/Codacy.Api/Models/CodacyProduct.cs @@ -0,0 +1,18 @@ +using System.Text.Json.Serialization; + +namespace Codacy.Api.Models; + +/// +/// Codacy product +/// +[JsonConverter(typeof(JsonStringEnumConverter))] +public enum CodacyProduct +{ + /// Quality + [JsonStringEnumMemberName("quality")] + Quality, + + /// Coverage + [JsonStringEnumMemberName("coverage")] + Coverage +} diff --git a/Codacy.Api/Models/CodeBlockLine.cs b/Codacy.Api/Models/CodeBlockLine.cs new file mode 100644 index 0000000..6a96f2e --- /dev/null +++ b/Codacy.Api/Models/CodeBlockLine.cs @@ -0,0 +1,13 @@ +namespace Codacy.Api.Models; + +/// +/// Line of a code block +/// +public class CodeBlockLine +{ + /// Line number + public required int Number { get; set; } + + /// Line content + public required string Content { get; set; } +} diff --git a/Codacy.Api/Models/CodeBlockLineListResponse.cs b/Codacy.Api/Models/CodeBlockLineListResponse.cs new file mode 100644 index 0000000..0ed99a4 --- /dev/null +++ b/Codacy.Api/Models/CodeBlockLineListResponse.cs @@ -0,0 +1,10 @@ +namespace Codacy.Api.Models; + +/// +/// Code block line list response +/// +public class CodeBlockLineListResponse +{ + /// Lines of the code block + public required List Data { get; set; } +} diff --git a/Codacy.Api/Models/CommitDetailsV2.cs b/Codacy.Api/Models/CommitDetailsV2.cs new file mode 100644 index 0000000..07fafca --- /dev/null +++ b/Codacy.Api/Models/CommitDetailsV2.cs @@ -0,0 +1,13 @@ +namespace Codacy.Api.Models; + +/// +/// Details of a commit +/// +public class CommitDetailsV2 +{ + /// The commit + public required Commit Commit { get; set; } + + /// The repository of the commit + public required RepositoryIdentificationV2 Repository { get; set; } +} diff --git a/Codacy.Api/Models/CommitIssue.cs b/Codacy.Api/Models/CommitIssue.cs new file mode 100644 index 0000000..e73b1da --- /dev/null +++ b/Codacy.Api/Models/CommitIssue.cs @@ -0,0 +1,61 @@ +namespace Codacy.Api.Models; + +/// +/// Issue details including the commit that originated the issue +/// +public class CommitIssue +{ + /// ID of the issue + public required string IssueId { get; set; } + + /// Stable ID for the issue + public required long ResultDataId { get; set; } + + /// Path of the file where the issue was found + public required string FilePath { get; set; } + + /// File ID + public required long FileId { get; set; } + + /// Pattern information + public required PatternDetails PatternInfo { get; set; } + + /// Tool information + public required ToolReference ToolInfo { get; set; } + + /// Line where the issue was found + public required long LineNumber { get; set; } + + /// Detailed cause of the issue + public required string Message { get; set; } + + /// The suggested fix for the issue + public string? Suggestion { get; set; } + + /// Language of the file where the issue was found + public required string Language { get; set; } + + /// Contents of the line where the issue was found + public required string LineText { get; set; } + + /// Commit that introduced the issue + public CommitReference? CommitInfo { get; set; } + + /// Probability that the issue is a false positive + public int? FalsePositiveProbability { get; set; } + + /// Reasoning for the false positive + public string? FalsePositiveReason { get; set; } + + /// Threshold for false positive detection + public required int FalsePositiveThreshold { get; set; } + + /// Advisory information, only present for SCA issues + public AdvisoryInformation? AdvisoryInformation { get; set; } + + /// Dependency chains from the root package to the vulnerable package, only present for SCA findings + public List>? DependencyChains { get; set; } + + /// Versions that fix the vulnerable dependency, empty when no fix is available, only present for SCA issues + public List? FixedVersion { get; set; } +} diff --git a/Codacy.Api/Models/CommitUuidRequest.cs b/Codacy.Api/Models/CommitUuidRequest.cs new file mode 100644 index 0000000..2ee14a9 --- /dev/null +++ b/Codacy.Api/Models/CommitUuidRequest.cs @@ -0,0 +1,13 @@ +namespace Codacy.Api.Models; + +/// +/// Identifies a commit to reanalyze +/// +public class CommitUuidRequest +{ + /// UUID or SHA string that identifies the commit + public required string CommitUuid { get; set; } + + /// If true, the cache will be cleaned before the analysis + public bool? CleanCache { get; set; } +} diff --git a/Codacy.Api/Models/CommitWithBranches.cs b/Codacy.Api/Models/CommitWithBranches.cs new file mode 100644 index 0000000..c48514e --- /dev/null +++ b/Codacy.Api/Models/CommitWithBranches.cs @@ -0,0 +1,10 @@ +namespace Codacy.Api.Models; + +/// +/// Commit with the branches that contain it +/// +public class CommitWithBranches : Commit +{ + /// List of branches containing the commit + public List? Branches { get; set; } +} diff --git a/Codacy.Api/Models/ComplianceType.cs b/Codacy.Api/Models/ComplianceType.cs new file mode 100644 index 0000000..3a7a3b9 --- /dev/null +++ b/Codacy.Api/Models/ComplianceType.cs @@ -0,0 +1,14 @@ +using System.Text.Json.Serialization; + +namespace Codacy.Api.Models; + +/// +/// The type of compliance standard +/// +[JsonConverter(typeof(JsonStringEnumConverter))] +public enum ComplianceType +{ + /// AI risk + [JsonStringEnumMemberName("ai-risk")] + AiRisk +} diff --git a/Codacy.Api/Models/ConfigurationStatusMetadata.cs b/Codacy.Api/Models/ConfigurationStatusMetadata.cs new file mode 100644 index 0000000..c73dc5a --- /dev/null +++ b/Codacy.Api/Models/ConfigurationStatusMetadata.cs @@ -0,0 +1,10 @@ +namespace Codacy.Api.Models; + +/// +/// Configuration status metadata +/// +public class ConfigurationStatusMetadata +{ + /// Whether the first signup is done + public required bool FirstSignupDone { get; set; } +} diff --git a/Codacy.Api/Models/ConfigurationStatusResponse.cs b/Codacy.Api/Models/ConfigurationStatusResponse.cs new file mode 100644 index 0000000..e19e525 --- /dev/null +++ b/Codacy.Api/Models/ConfigurationStatusResponse.cs @@ -0,0 +1,13 @@ +namespace Codacy.Api.Models; + +/// +/// Configuration status response +/// +public class ConfigurationStatusResponse +{ + /// Statuses + public List? Statuses { get; set; } + + /// Metadata + public ConfigurationStatusMetadata? Metadata { get; set; } +} diff --git a/Codacy.Api/Models/ConfiguredLoginIntegration.cs b/Codacy.Api/Models/ConfiguredLoginIntegration.cs new file mode 100644 index 0000000..4bfacee --- /dev/null +++ b/Codacy.Api/Models/ConfiguredLoginIntegration.cs @@ -0,0 +1,13 @@ +namespace Codacy.Api.Models; + +/// +/// Configured login provider +/// +public class ConfiguredLoginIntegration +{ + /// Git provider + public required Provider Provider { get; set; } + + /// Login URL + public required string LoginUrl { get; set; } +} diff --git a/Codacy.Api/Models/ConfiguredParameter.cs b/Codacy.Api/Models/ConfiguredParameter.cs new file mode 100644 index 0000000..7dbb103 --- /dev/null +++ b/Codacy.Api/Models/ConfiguredParameter.cs @@ -0,0 +1,13 @@ +namespace Codacy.Api.Models; + +/// +/// Parameter to configure a code pattern for a tool +/// +public class ConfiguredParameter +{ + /// Code pattern parameter name + public required string Name { get; set; } + + /// Code pattern parameter value + public required string Value { get; set; } +} diff --git a/Codacy.Api/Models/CoverageReportContent.cs b/Codacy.Api/Models/CoverageReportContent.cs new file mode 100644 index 0000000..18daa85 --- /dev/null +++ b/Codacy.Api/Models/CoverageReportContent.cs @@ -0,0 +1,10 @@ +namespace Codacy.Api.Models; + +/// +/// Coverage report entry including its content +/// +public class CoverageReportContent : CoverageReportEntry +{ + /// Coverage report per file + public required List Content { get; set; } +} diff --git a/Codacy.Api/Models/CoverageReportContentResponse.cs b/Codacy.Api/Models/CoverageReportContentResponse.cs new file mode 100644 index 0000000..c603b73 --- /dev/null +++ b/Codacy.Api/Models/CoverageReportContentResponse.cs @@ -0,0 +1,10 @@ +namespace Codacy.Api.Models; + +/// +/// Coverage report content response +/// +public class CoverageReportContentResponse +{ + /// Report content + public required CoverageReportContent Data { get; set; } +} diff --git a/Codacy.Api/Models/CoverageReportEntry.cs b/Codacy.Api/Models/CoverageReportEntry.cs new file mode 100644 index 0000000..841fd95 --- /dev/null +++ b/Codacy.Api/Models/CoverageReportEntry.cs @@ -0,0 +1,28 @@ +namespace Codacy.Api.Models; + +/// +/// Entry of a coverage report uploaded for a commit +/// +public class CoverageReportEntry +{ + /// Repository ID + public required long RepositoryId { get; set; } + + /// Commit SHA + public required string CommitSha { get; set; } + + /// Report ID + public required string ReportId { get; set; } + + /// Language of the report + public string? Language { get; set; } + + /// Whether this is the final report + public required bool IsFinal { get; set; } + + /// Whether the report was processed + public required bool Processed { get; set; } + + /// Report creation date + public required DateTimeOffset CreatedAt { get; set; } +} diff --git a/Codacy.Api/Models/CoverageReportFile.cs b/Codacy.Api/Models/CoverageReportFile.cs new file mode 100644 index 0000000..a0c6310 --- /dev/null +++ b/Codacy.Api/Models/CoverageReportFile.cs @@ -0,0 +1,13 @@ +namespace Codacy.Api.Models; + +/// +/// Coverage report for a file +/// +public class CoverageReportFile +{ + /// Name of the file + public required string FileName { get; set; } + + /// Coverage map from line number to number of hits + public required Dictionary Coverage { get; set; } +} diff --git a/Codacy.Api/Models/CoverageReportOverview.cs b/Codacy.Api/Models/CoverageReportOverview.cs new file mode 100644 index 0000000..6b4602b --- /dev/null +++ b/Codacy.Api/Models/CoverageReportOverview.cs @@ -0,0 +1,13 @@ +namespace Codacy.Api.Models; + +/// +/// Latest coverage reports of a repository +/// +public class CoverageReportOverview +{ + /// True if the Quality evolution chart of the repository includes coverage information + public bool? HasCoverageOverview { get; set; } + + /// Last coverage reports + public List? LastReports { get; set; } +} diff --git a/Codacy.Api/Models/CoverageReportResponse.cs b/Codacy.Api/Models/CoverageReportResponse.cs new file mode 100644 index 0000000..00b3052 --- /dev/null +++ b/Codacy.Api/Models/CoverageReportResponse.cs @@ -0,0 +1,10 @@ +namespace Codacy.Api.Models; + +/// +/// Coverage report response +/// +public class CoverageReportResponse +{ + /// Coverage report overview + public required CoverageReportOverview Data { get; set; } +} diff --git a/Codacy.Api/Models/CoverageReportStatus.cs b/Codacy.Api/Models/CoverageReportStatus.cs new file mode 100644 index 0000000..66648c9 --- /dev/null +++ b/Codacy.Api/Models/CoverageReportStatus.cs @@ -0,0 +1,28 @@ +using System.Text.Json.Serialization; + +namespace Codacy.Api.Models; + +/// +/// Coverage status +/// +[JsonConverter(typeof(JsonStringEnumConverter))] +public enum CoverageReportStatus +{ + /// Pending + Pending, + + /// Processed + Processed, + + /// Commit not analysed + CommitNotAnalysed, + + /// Commit not found + CommitNotFound, + + /// Branch not enabled + BranchNotEnabled, + + /// Missing final report + MissingFinal +} diff --git a/Codacy.Api/Models/CreateComplianceStandardBody.cs b/Codacy.Api/Models/CreateComplianceStandardBody.cs new file mode 100644 index 0000000..efeaec0 --- /dev/null +++ b/Codacy.Api/Models/CreateComplianceStandardBody.cs @@ -0,0 +1,13 @@ +namespace Codacy.Api.Models; + +/// +/// Details required to create a compliance standard +/// +public class CreateComplianceStandardBody +{ + /// Name of the compliance standard + public required string Name { get; set; } + + /// The type of compliance standard + public required ComplianceType ComplianceType { get; set; } +} diff --git a/Codacy.Api/Models/CreateDastTargetBody.cs b/Codacy.Api/Models/CreateDastTargetBody.cs new file mode 100644 index 0000000..809597e --- /dev/null +++ b/Codacy.Api/Models/CreateDastTargetBody.cs @@ -0,0 +1,19 @@ +namespace Codacy.Api.Models; + +/// +/// Body to create a DAST target +/// +public class CreateDastTargetBody +{ + /// Target URL + public required string Url { get; set; } + + /// Target type + public DastTargetType? TargetType { get; set; } + + /// API definition URL + public string? ApiDefinitionUrl { get; set; } + + /// API authentication headers, by header name + public Dictionary? ApiAuthHeaders { get; set; } +} diff --git a/Codacy.Api/Models/CreateGatePolicyBody.cs b/Codacy.Api/Models/CreateGatePolicyBody.cs new file mode 100644 index 0000000..76c3b66 --- /dev/null +++ b/Codacy.Api/Models/CreateGatePolicyBody.cs @@ -0,0 +1,16 @@ +namespace Codacy.Api.Models; + +/// +/// Details of a new gate policy +/// +public class CreateGatePolicyBody +{ + /// Name of the gate policy + public required string GatePolicyName { get; set; } + + /// True if the gate policy is the default for the organization + public bool? IsDefault { get; set; } + + /// Quality gate settings + public QualityGate? Settings { get; set; } +} diff --git a/Codacy.Api/Models/CreateJiraTicketBody.cs b/Codacy.Api/Models/CreateJiraTicketBody.cs new file mode 100644 index 0000000..57307a0 --- /dev/null +++ b/Codacy.Api/Models/CreateJiraTicketBody.cs @@ -0,0 +1,28 @@ +namespace Codacy.Api.Models; + +/// +/// Fields used to create a Jira ticket +/// +public class CreateJiraTicketBody +{ + /// Type of Codacy element + public required ElementType ElementType { get; set; } + + /// Jira project identifier + public required long JiraProjectId { get; set; } + + /// Codacy elements to include in the ticket + public required List CreateJiraTicketElements { get; set; } + + /// Jira issue type identifier + public required long IssueTypeId { get; set; } + + /// Ticket summary + public required string Summary { get; set; } + + /// Description written in Atlassian Document Format + public required string Description { get; set; } + + /// Optional due date + public DateOnly? DueDate { get; set; } +} diff --git a/Codacy.Api/Models/CreateJiraTicketElement.cs b/Codacy.Api/Models/CreateJiraTicketElement.cs new file mode 100644 index 0000000..40fe743 --- /dev/null +++ b/Codacy.Api/Models/CreateJiraTicketElement.cs @@ -0,0 +1,13 @@ +namespace Codacy.Api.Models; + +/// +/// A Codacy element to include in a Jira ticket +/// +public class CreateJiraTicketElement +{ + /// Element identifier + public required string ElementId { get; set; } + + /// Repository name + public string? RepositoryName { get; set; } +} diff --git a/Codacy.Api/Models/CreateJiraTicketResponse.cs b/Codacy.Api/Models/CreateJiraTicketResponse.cs new file mode 100644 index 0000000..4cbe62d --- /dev/null +++ b/Codacy.Api/Models/CreateJiraTicketResponse.cs @@ -0,0 +1,10 @@ +namespace Codacy.Api.Models; + +/// +/// Create Jira ticket response +/// +public class CreateJiraTicketResponse +{ + /// The created ticket + public required JiraTicket Data { get; set; } +} diff --git a/Codacy.Api/Models/CreateWebhookEndpointBody.cs b/Codacy.Api/Models/CreateWebhookEndpointBody.cs new file mode 100644 index 0000000..837e419 --- /dev/null +++ b/Codacy.Api/Models/CreateWebhookEndpointBody.cs @@ -0,0 +1,10 @@ +namespace Codacy.Api.Models; + +/// +/// Request body to create a webhook endpoint +/// +public class CreateWebhookEndpointBody +{ + /// URL that Codacy POSTs deliveries to + public required string Url { get; set; } +} diff --git a/Codacy.Api/Models/DastAnalysisStatus.cs b/Codacy.Api/Models/DastAnalysisStatus.cs new file mode 100644 index 0000000..a73b8e6 --- /dev/null +++ b/Codacy.Api/Models/DastAnalysisStatus.cs @@ -0,0 +1,26 @@ +using System.Text.Json.Serialization; + +namespace Codacy.Api.Models; + +/// +/// The analysis status of a DAST target +/// +[JsonConverter(typeof(JsonStringEnumConverter))] +public enum DastAnalysisStatus +{ + /// Queued + [JsonStringEnumMemberName("queued")] + Queued, + + /// Running + [JsonStringEnumMemberName("running")] + Running, + + /// Successful + [JsonStringEnumMemberName("successful")] + Successful, + + /// Failed + [JsonStringEnumMemberName("failed")] + Failed +} diff --git a/Codacy.Api/Models/DastTarget.cs b/Codacy.Api/Models/DastTarget.cs new file mode 100644 index 0000000..ca13f12 --- /dev/null +++ b/Codacy.Api/Models/DastTarget.cs @@ -0,0 +1,25 @@ +namespace Codacy.Api.Models; + +/// +/// A target for DAST analysis +/// +public class DastTarget +{ + /// Target identifier + public required long Id { get; set; } + + /// Target URL + public required string Url { get; set; } + + /// The analysis statuses the target is in. Can be empty if the target was never analysed. + public required List Status { get; set; } + + /// Target type + public DastTargetType? TargetType { get; set; } + + /// API definition URL + public string? ApiDefinitionUrl { get; set; } + + /// Names of the API authentication headers + public List? ApiAuthHeaderNames { get; set; } +} diff --git a/Codacy.Api/Models/DastTargetResponse.cs b/Codacy.Api/Models/DastTargetResponse.cs new file mode 100644 index 0000000..a189999 --- /dev/null +++ b/Codacy.Api/Models/DastTargetResponse.cs @@ -0,0 +1,10 @@ +namespace Codacy.Api.Models; + +/// +/// A response with a target for DAST analysis +/// +public class DastTargetResponse +{ + /// The target + public required DastTarget Data { get; set; } +} diff --git a/Codacy.Api/Models/DastTargetStatus.cs b/Codacy.Api/Models/DastTargetStatus.cs new file mode 100644 index 0000000..4bd54bc --- /dev/null +++ b/Codacy.Api/Models/DastTargetStatus.cs @@ -0,0 +1,19 @@ +namespace Codacy.Api.Models; + +/// +/// The current analysis status of a DAST target +/// +public class DastTargetStatus +{ + /// The current analysis status + public required DastAnalysisStatus Status { get; set; } + + /// When the target transitioned to this status + public required DateTimeOffset TransitionedAt { get; set; } + + /// An optional description of why the target transitioned to the current status + public string? TransitionReason { get; set; } + + /// The DAST analysis id associated with this status + public required Guid AnalysisId { get; set; } +} diff --git a/Codacy.Api/Models/DastTargetType.cs b/Codacy.Api/Models/DastTargetType.cs new file mode 100644 index 0000000..34288f4 --- /dev/null +++ b/Codacy.Api/Models/DastTargetType.cs @@ -0,0 +1,22 @@ +using System.Text.Json.Serialization; + +namespace Codacy.Api.Models; + +/// +/// DAST target type +/// +[JsonConverter(typeof(JsonStringEnumConverter))] +public enum DastTargetType +{ + /// Web application + [JsonStringEnumMemberName("webapp")] + WebApp, + + /// OpenAPI definition + [JsonStringEnumMemberName("openapi")] + OpenApi, + + /// GraphQL + [JsonStringEnumMemberName("graphql")] + GraphQl +} diff --git a/Codacy.Api/Models/DeleteDormantAccountsResponse.cs b/Codacy.Api/Models/DeleteDormantAccountsResponse.cs new file mode 100644 index 0000000..101cb37 --- /dev/null +++ b/Codacy.Api/Models/DeleteDormantAccountsResponse.cs @@ -0,0 +1,10 @@ +namespace Codacy.Api.Models; + +/// +/// Delete dormant accounts response +/// +public class DeleteDormantAccountsResponse +{ + /// Deleted accounts + public required List Data { get; set; } +} diff --git a/Codacy.Api/Models/DependenciesOverviewOfSbomRepositories.cs b/Codacy.Api/Models/DependenciesOverviewOfSbomRepositories.cs new file mode 100644 index 0000000..924445e --- /dev/null +++ b/Codacy.Api/Models/DependenciesOverviewOfSbomRepositories.cs @@ -0,0 +1,19 @@ +namespace Codacy.Api.Models; + +/// +/// Overview of dependencies used across repositories +/// +public class DependenciesOverviewOfSbomRepositories +{ + /// Total repositories with dependency information (not affected by filtering) + public required int TotalRepositoriesCount { get; set; } + + /// Filtered repositories with dependency information + public required int FilteredRepositoriesCount { get; set; } + + /// Total dependencies across repositories (not affected by filtering) + public required long TotalDependenciesCount { get; set; } + + /// Filtered dependencies across repositories + public required long FilteredDependenciesCount { get; set; } +} diff --git a/Codacy.Api/Models/DependenciesSummaryOfSbomRepository.cs b/Codacy.Api/Models/DependenciesSummaryOfSbomRepository.cs new file mode 100644 index 0000000..9d95443 --- /dev/null +++ b/Codacy.Api/Models/DependenciesSummaryOfSbomRepository.cs @@ -0,0 +1,19 @@ +namespace Codacy.Api.Models; + +/// +/// Summary of the dependencies of a repository +/// +public class DependenciesSummaryOfSbomRepository +{ + /// The identifier of the repository + public required long Id { get; set; } + + /// The name of the repository + public required string Name { get; set; } + + /// Number of dependencies, including indirect ones + public required int DependenciesCount { get; set; } + + /// Open findings count, per severity, for the dependencies of this repository + public required List DependenciesFindings { get; set; } +} diff --git a/Codacy.Api/Models/DiffResponse.cs b/Codacy.Api/Models/DiffResponse.cs new file mode 100644 index 0000000..3d7ac96 --- /dev/null +++ b/Codacy.Api/Models/DiffResponse.cs @@ -0,0 +1,10 @@ +namespace Codacy.Api.Models; + +/// +/// Human-readable Git diff of a commit or pull request +/// +public class DiffResponse +{ + /// The diff, in the output format of the git diff command + public required string Diff { get; set; } +} diff --git a/Codacy.Api/Models/DimensionsFilter.cs b/Codacy.Api/Models/DimensionsFilter.cs new file mode 100644 index 0000000..5ddf50e --- /dev/null +++ b/Codacy.Api/Models/DimensionsFilter.cs @@ -0,0 +1,13 @@ +namespace Codacy.Api.Models; + +/// +/// Restricts a metric query to a dimension value +/// +public class DimensionsFilter +{ + /// Dimension name + public required string Dimension { get; set; } + + /// Dimension value + public required string Value { get; set; } +} diff --git a/Codacy.Api/Models/DirectoryWithAnalysisInfo.cs b/Codacy.Api/Models/DirectoryWithAnalysisInfo.cs new file mode 100644 index 0000000..024ea0a --- /dev/null +++ b/Codacy.Api/Models/DirectoryWithAnalysisInfo.cs @@ -0,0 +1,46 @@ +namespace Codacy.Api.Models; + +/// +/// Folder with analysis information +/// +public class DirectoryWithAnalysisInfo +{ + /// Full path of the folder in the repository + public required string Path { get; set; } + + /// Name of the folder, that is the last segment of its path + public required string Name { get; set; } + + /// Number of files in the folder, including all subfolders + public required int NrFiles { get; set; } + + /// Number of issues in the folder, including all subfolders + public required int TotalIssues { get; set; } + + /// Quality grade of the folder between 100 (highest) and 0 (lowest) + public required int Grade { get; set; } + + /// Quality grade of the folder as a letter between A (highest) and F (lowest) + public required string GradeLetter { get; set; } + + /// Highest complexity of a file in the folder + public int? Complexity { get; set; } + + /// Total complexity of all files in the folder + public int? ComplexitySum { get; set; } + + /// Number of duplicated lines in the folder + public int? Duplication { get; set; } + + /// Number of cloned blocks of code in the folder + public int? NumberOfClones { get; set; } + + /// Test coverage percentage of the folder with decimals + public double? CoverageWithDecimals { get; set; } + + /// Coverable lines of code in the folder + public int? SourceLinesOfCode { get; set; } + + /// Lines of code in the folder + public int? LinesOfCode { get; set; } +} diff --git a/Codacy.Api/Models/DormantAccountInfo.cs b/Codacy.Api/Models/DormantAccountInfo.cs new file mode 100644 index 0000000..3c0d589 --- /dev/null +++ b/Codacy.Api/Models/DormantAccountInfo.cs @@ -0,0 +1,10 @@ +namespace Codacy.Api.Models; + +/// +/// Dormant account information +/// +public class DormantAccountInfo +{ + /// Email address of the deleted account + public required string Email { get; set; } +} diff --git a/Codacy.Api/Models/DuplicationTool.cs b/Codacy.Api/Models/DuplicationTool.cs new file mode 100644 index 0000000..ea3133b --- /dev/null +++ b/Codacy.Api/Models/DuplicationTool.cs @@ -0,0 +1,13 @@ +namespace Codacy.Api.Models; + +/// +/// Codacy tool that can detect duplication on projects +/// +public class DuplicationTool +{ + /// Docker image used to launch the tool + public required string DockerImage { get; set; } + + /// Languages that the tool supports + public required List Languages { get; set; } +} diff --git a/Codacy.Api/Models/DuplicationToolListResponse.cs b/Codacy.Api/Models/DuplicationToolListResponse.cs new file mode 100644 index 0000000..c601a68 --- /dev/null +++ b/Codacy.Api/Models/DuplicationToolListResponse.cs @@ -0,0 +1,10 @@ +namespace Codacy.Api.Models; + +/// +/// List of duplication tools +/// +public class DuplicationToolListResponse +{ + /// Duplication tools + public required List Data { get; set; } +} diff --git a/Codacy.Api/Models/ElementType.cs b/Codacy.Api/Models/ElementType.cs new file mode 100644 index 0000000..0a4c328 --- /dev/null +++ b/Codacy.Api/Models/ElementType.cs @@ -0,0 +1,26 @@ +using System.Text.Json.Serialization; + +namespace Codacy.Api.Models; + +/// +/// Type of Codacy element +/// +[JsonConverter(typeof(JsonStringEnumConverter))] +public enum ElementType +{ + /// Issue + [JsonStringEnumMemberName("issue")] + Issue, + + /// Finding + [JsonStringEnumMemberName("finding")] + Finding, + + /// File + [JsonStringEnumMemberName("file")] + File, + + /// Dependency + [JsonStringEnumMemberName("dependency")] + Dependency +} diff --git a/Codacy.Api/Models/EnterpriseAccountToken.cs b/Codacy.Api/Models/EnterpriseAccountToken.cs new file mode 100644 index 0000000..89c0430 --- /dev/null +++ b/Codacy.Api/Models/EnterpriseAccountToken.cs @@ -0,0 +1,10 @@ +namespace Codacy.Api.Models; + +/// +/// Enterprise account token +/// +public class EnterpriseAccountToken +{ + /// Git provider + public required Provider Provider { get; set; } +} diff --git a/Codacy.Api/Models/EnterpriseEntity.cs b/Codacy.Api/Models/EnterpriseEntity.cs new file mode 100644 index 0000000..e47db4e --- /dev/null +++ b/Codacy.Api/Models/EnterpriseEntity.cs @@ -0,0 +1,25 @@ +namespace Codacy.Api.Models; + +/// +/// Enterprise +/// +public class EnterpriseEntity +{ + /// Enterprise name, used as stable enterprise identifier + public required string Name { get; set; } + + /// Enterprise remote name, not the enterprise identifier + public required string DisplayName { get; set; } + + /// User role in the enterprise + public required EnterpriseUserRole UserRole { get; set; } + + /// Enterprise URL + public required string Url { get; set; } + + /// Enterprise avatar URL + public required string AvatarUrl { get; set; } + + /// Git provider + public required Provider Provider { get; set; } +} diff --git a/Codacy.Api/Models/EnterpriseGroupMetricFilter.cs b/Codacy.Api/Models/EnterpriseGroupMetricFilter.cs new file mode 100644 index 0000000..734926d --- /dev/null +++ b/Codacy.Api/Models/EnterpriseGroupMetricFilter.cs @@ -0,0 +1,13 @@ +namespace Codacy.Api.Models; + +/// +/// Request for the latest metric values grouped by dimension for an enterprise +/// +public class EnterpriseGroupMetricFilter +{ + /// Grouping options + public required MetricGroupBy GroupBy { get; set; } + + /// Metric filter + public required EnterpriseMetricFilter Filter { get; set; } +} diff --git a/Codacy.Api/Models/EnterpriseMetricFilter.cs b/Codacy.Api/Models/EnterpriseMetricFilter.cs new file mode 100644 index 0000000..a22db1d --- /dev/null +++ b/Codacy.Api/Models/EnterpriseMetricFilter.cs @@ -0,0 +1,16 @@ +using System.Text.Json.Serialization; + +namespace Codacy.Api.Models; + +/// +/// Filter for an enterprise metric query +/// +/// +/// The spec lists an enterpriseEntityFilter as required but does not define it, so it is not modelled. +/// +public class EnterpriseMetricFilter +{ + /// Dimension filters + [JsonPropertyName("dimensionsFilter")] + public List? Dimensions { get; set; } +} diff --git a/Codacy.Api/Models/EnterpriseOrganization.cs b/Codacy.Api/Models/EnterpriseOrganization.cs new file mode 100644 index 0000000..3b6804e --- /dev/null +++ b/Codacy.Api/Models/EnterpriseOrganization.cs @@ -0,0 +1,28 @@ +namespace Codacy.Api.Models; + +/// +/// Organization in an enterprise +/// +public class EnterpriseOrganization +{ + /// Internal Codacy organization id + public long? Id { get; set; } + + /// Organization ID in provider + public required string RemoteId { get; set; } + + /// Organization name + public required string Name { get; set; } + + /// Organization display name + public string? DisplayName { get; set; } + + /// User role in the organization + public EnterpriseUserRole? UserRole { get; set; } + + /// Organization URL + public required string Url { get; set; } + + /// Organization avatar URL + public required string Avatar { get; set; } +} diff --git a/Codacy.Api/Models/EnterprisePeriodGroupMetricFilterBody.cs b/Codacy.Api/Models/EnterprisePeriodGroupMetricFilterBody.cs new file mode 100644 index 0000000..b093770 --- /dev/null +++ b/Codacy.Api/Models/EnterprisePeriodGroupMetricFilterBody.cs @@ -0,0 +1,19 @@ +namespace Codacy.Api.Models; + +/// +/// Request for enterprise metric values for a specific period grouped by dimension +/// +public class EnterprisePeriodGroupMetricFilterBody +{ + /// Metric filter + public required EnterpriseMetricFilter Filter { get; set; } + + /// Grouping options + public required MetricGroupBy GroupBy { get; set; } + + /// Start date of the period + public required DateTimeOffset Date { get; set; } + + /// Period granularity + public required MetricPeriod Period { get; set; } +} diff --git a/Codacy.Api/Models/EnterprisePeriodMetricFilterBody.cs b/Codacy.Api/Models/EnterprisePeriodMetricFilterBody.cs new file mode 100644 index 0000000..d24ac84 --- /dev/null +++ b/Codacy.Api/Models/EnterprisePeriodMetricFilterBody.cs @@ -0,0 +1,16 @@ +namespace Codacy.Api.Models; + +/// +/// Request for an enterprise metric value for a specific period +/// +public class EnterprisePeriodMetricFilterBody +{ + /// Metric filter + public required EnterpriseMetricFilter Filter { get; set; } + + /// Start date of the period + public required DateTimeOffset Date { get; set; } + + /// Period granularity + public required MetricPeriod Period { get; set; } +} diff --git a/Codacy.Api/Models/EnterpriseTimerangeMetricFilterBody.cs b/Codacy.Api/Models/EnterpriseTimerangeMetricFilterBody.cs new file mode 100644 index 0000000..c4c74ec --- /dev/null +++ b/Codacy.Api/Models/EnterpriseTimerangeMetricFilterBody.cs @@ -0,0 +1,22 @@ +namespace Codacy.Api.Models; + +/// +/// Request for enterprise metric values over a time range +/// +public class EnterpriseTimerangeMetricFilterBody +{ + /// Metric filter + public required EnterpriseMetricFilter Filter { get; set; } + + /// Grouping options + public required MetricGroupBy GroupBy { get; set; } + + /// Start of the time range + public required DateTimeOffset From { get; set; } + + /// End of the time range + public required DateTimeOffset To { get; set; } + + /// Time granularity; if omitted, the backend chooses a default + public MetricPeriod? Period { get; set; } +} diff --git a/Codacy.Api/Models/EnterpriseUserRole.cs b/Codacy.Api/Models/EnterpriseUserRole.cs new file mode 100644 index 0000000..83f2b4a --- /dev/null +++ b/Codacy.Api/Models/EnterpriseUserRole.cs @@ -0,0 +1,18 @@ +using System.Text.Json.Serialization; + +namespace Codacy.Api.Models; + +/// +/// User role in an enterprise or enterprise organization +/// +[JsonConverter(typeof(JsonStringEnumConverter))] +public enum EnterpriseUserRole +{ + /// Admin + [JsonStringEnumMemberName("admin")] + Admin, + + /// Member + [JsonStringEnumMemberName("member")] + Member +} diff --git a/Codacy.Api/Models/EntityFilter.cs b/Codacy.Api/Models/EntityFilter.cs new file mode 100644 index 0000000..350aa93 --- /dev/null +++ b/Codacy.Api/Models/EntityFilter.cs @@ -0,0 +1,13 @@ +namespace Codacy.Api.Models; + +/// +/// Restricts a metric query to specific repositories or segments +/// +public class EntityFilter +{ + /// Repository names + public List? Repositories { get; set; } + + /// Segment identifiers + public List? SegmentIds { get; set; } +} diff --git a/Codacy.Api/Models/FileClone.cs b/Codacy.Api/Models/FileClone.cs new file mode 100644 index 0000000..ac2874b --- /dev/null +++ b/Codacy.Api/Models/FileClone.cs @@ -0,0 +1,13 @@ +namespace Codacy.Api.Models; + +/// +/// A duplicated code block within a file, including its occurrences +/// +public class FileClone +{ + /// Clone ID + public required long Id { get; set; } + + /// Occurrences of the duplicated block + public required List Occurrences { get; set; } +} diff --git a/Codacy.Api/Models/FileLineCoverage.cs b/Codacy.Api/Models/FileLineCoverage.cs new file mode 100644 index 0000000..00da5da --- /dev/null +++ b/Codacy.Api/Models/FileLineCoverage.cs @@ -0,0 +1,13 @@ +namespace Codacy.Api.Models; + +/// +/// Coverage information for a line of a file (spec schema FileCoverage, renamed to avoid the existing FileCoverage type) +/// +public class FileLineCoverage +{ + /// Line number + public required int Line { get; set; } + + /// Number of test hits for the line + public required int Hits { get; set; } +} diff --git a/Codacy.Api/Models/FileStateBody.cs b/Codacy.Api/Models/FileStateBody.cs new file mode 100644 index 0000000..81e738f --- /dev/null +++ b/Codacy.Api/Models/FileStateBody.cs @@ -0,0 +1,13 @@ +namespace Codacy.Api.Models; + +/// +/// Ignored status of a file +/// +public class FileStateBody +{ + /// Relative path of the file in the repository + public required string Filepath { get; set; } + + /// True if the file is ignored + public required bool Ignored { get; set; } +} diff --git a/Codacy.Api/Models/FindingSeverity.cs b/Codacy.Api/Models/FindingSeverity.cs new file mode 100644 index 0000000..df4c5ad --- /dev/null +++ b/Codacy.Api/Models/FindingSeverity.cs @@ -0,0 +1,22 @@ +using System.Text.Json.Serialization; + +namespace Codacy.Api.Models; + +/// +/// Finding severity level +/// +[JsonConverter(typeof(JsonStringEnumConverter))] +public enum FindingSeverity +{ + /// Critical + Critical, + + /// High + High, + + /// Medium + Medium, + + /// Low + Low +} diff --git a/Codacy.Api/Models/GatePoliciesListResponse.cs b/Codacy.Api/Models/GatePoliciesListResponse.cs new file mode 100644 index 0000000..391a7f4 --- /dev/null +++ b/Codacy.Api/Models/GatePoliciesListResponse.cs @@ -0,0 +1,10 @@ +namespace Codacy.Api.Models; + +/// +/// List of gate policies for an organization +/// +public class GatePoliciesListResponse +{ + /// The gate policies + public required List Data { get; set; } +} diff --git a/Codacy.Api/Models/GatePolicy.cs b/Codacy.Api/Models/GatePolicy.cs new file mode 100644 index 0000000..cb3b38c --- /dev/null +++ b/Codacy.Api/Models/GatePolicy.cs @@ -0,0 +1,25 @@ +namespace Codacy.Api.Models; + +/// +/// Details of the gate policy +/// +public class GatePolicy +{ + /// Identifier of the gate policy + public required long Id { get; set; } + + /// Name of the gate policy + public required string Name { get; set; } + + /// True if the gate policy is the default for the organization + public required bool IsDefault { get; set; } + + /// True if the quality gates of the gate policy cannot be changed + public required bool ReadOnly { get; set; } + + /// Quality gate settings + public required QualityGate Settings { get; set; } + + /// Meta information about the gate policy + public required GatePolicyMeta Meta { get; set; } +} diff --git a/Codacy.Api/Models/GatePolicyMeta.cs b/Codacy.Api/Models/GatePolicyMeta.cs new file mode 100644 index 0000000..50e0b5c --- /dev/null +++ b/Codacy.Api/Models/GatePolicyMeta.cs @@ -0,0 +1,13 @@ +namespace Codacy.Api.Models; + +/// +/// Meta information about a gate policy +/// +public class GatePolicyMeta +{ + /// Number of quality gates that are configured in the gate policy + public required int NrOfQualityGates { get; set; } + + /// Number of repositories following the gate policy + public required int LinkedRepositoriesCount { get; set; } +} diff --git a/Codacy.Api/Models/GatePolicySummarized.cs b/Codacy.Api/Models/GatePolicySummarized.cs new file mode 100644 index 0000000..40dfd74 --- /dev/null +++ b/Codacy.Api/Models/GatePolicySummarized.cs @@ -0,0 +1,22 @@ +namespace Codacy.Api.Models; + +/// +/// Gate policy summary information, without the quality gate settings +/// +public class GatePolicySummarized +{ + /// Identifier of the gate policy + public required long Id { get; set; } + + /// Name of the gate policy + public required string Name { get; set; } + + /// True if the gate policy is the default for the organization + public required bool IsDefault { get; set; } + + /// True if the quality gates of the gate policy cannot be changed + public required bool ReadOnly { get; set; } + + /// Meta information about the gate policy + public required GatePolicyMeta Meta { get; set; } +} diff --git a/Codacy.Api/Models/GetAiInventoryProviderSummaryBody.cs b/Codacy.Api/Models/GetAiInventoryProviderSummaryBody.cs new file mode 100644 index 0000000..c748a1e --- /dev/null +++ b/Codacy.Api/Models/GetAiInventoryProviderSummaryBody.cs @@ -0,0 +1,25 @@ +namespace Codacy.Api.Models; + +/// +/// Required AI provider identity plus optional filters scoping the returned summary +/// +public class GetAiInventoryProviderSummaryBody +{ + /// AI provider name to return the summary for + public required string AiProvider { get; set; } + + /// Inventory item types to filter by + public List? InventoryItemTypes { get; set; } + + /// Segment IDs to filter by + public List? Segments { get; set; } + + /// Repository names to filter by + public List? Repositories { get; set; } + + /// Inventory category groups to filter by + public List? CategoryGroups { get; set; } + + /// Inventory categories to filter by + public List? Categories { get; set; } +} diff --git a/Codacy.Api/Models/GetEnterpriseResponse.cs b/Codacy.Api/Models/GetEnterpriseResponse.cs new file mode 100644 index 0000000..21c9288 --- /dev/null +++ b/Codacy.Api/Models/GetEnterpriseResponse.cs @@ -0,0 +1,10 @@ +namespace Codacy.Api.Models; + +/// +/// Get enterprise response +/// +public class GetEnterpriseResponse +{ + /// Enterprise + public required EnterpriseEntity Data { get; set; } +} diff --git a/Codacy.Api/Models/GetFileCoverageResponse.cs b/Codacy.Api/Models/GetFileCoverageResponse.cs new file mode 100644 index 0000000..9f15a07 --- /dev/null +++ b/Codacy.Api/Models/GetFileCoverageResponse.cs @@ -0,0 +1,10 @@ +namespace Codacy.Api.Models; + +/// +/// File coverage response +/// +public class GetFileCoverageResponse +{ + /// Coverage per line + public required List Data { get; set; } +} diff --git a/Codacy.Api/Models/GetGatePolicyResultResponse.cs b/Codacy.Api/Models/GetGatePolicyResultResponse.cs new file mode 100644 index 0000000..498bf08 --- /dev/null +++ b/Codacy.Api/Models/GetGatePolicyResultResponse.cs @@ -0,0 +1,10 @@ +namespace Codacy.Api.Models; + +/// +/// Response containing a gate policy +/// +public class GetGatePolicyResultResponse +{ + /// The gate policy + public required GatePolicy Data { get; set; } +} diff --git a/Codacy.Api/Models/GetJiraTicketsResponse.cs b/Codacy.Api/Models/GetJiraTicketsResponse.cs new file mode 100644 index 0000000..8619df0 --- /dev/null +++ b/Codacy.Api/Models/GetJiraTicketsResponse.cs @@ -0,0 +1,10 @@ +namespace Codacy.Api.Models; + +/// +/// Jira tickets retrieval response +/// +public class GetJiraTicketsResponse +{ + /// The Jira tickets + public required List Data { get; set; } +} diff --git a/Codacy.Api/Models/GitProviderAppPermissions.cs b/Codacy.Api/Models/GitProviderAppPermissions.cs new file mode 100644 index 0000000..30eefa6 --- /dev/null +++ b/Codacy.Api/Models/GitProviderAppPermissions.cs @@ -0,0 +1,13 @@ +namespace Codacy.Api.Models; + +/// +/// Information about Codacy GitHub App repository permissions +/// +public class GitProviderAppPermissions +{ + /// True if the app has repository Contents permissions + public required bool ContentPermission { get; set; } + + /// True if the app has custom properties permissions + public required bool CustomPropertiesPermission { get; set; } +} diff --git a/Codacy.Api/Models/GroupMetricFilter.cs b/Codacy.Api/Models/GroupMetricFilter.cs new file mode 100644 index 0000000..79d3e51 --- /dev/null +++ b/Codacy.Api/Models/GroupMetricFilter.cs @@ -0,0 +1,13 @@ +namespace Codacy.Api.Models; + +/// +/// Request for the latest metric values grouped by dimension +/// +public class GroupMetricFilter +{ + /// Metric filter + public required MetricFilter Filter { get; set; } + + /// Grouping options + public required MetricGroupBy GroupBy { get; set; } +} diff --git a/Codacy.Api/Models/HasQuickfixSuggestionsResponse.cs b/Codacy.Api/Models/HasQuickfixSuggestionsResponse.cs new file mode 100644 index 0000000..6c5594c --- /dev/null +++ b/Codacy.Api/Models/HasQuickfixSuggestionsResponse.cs @@ -0,0 +1,10 @@ +namespace Codacy.Api.Models; + +/// +/// Whether a repository has quick fix suggestions +/// +public class HasQuickfixSuggestionsResponse +{ + /// True if there are quick fix suggestions + public required bool HasSuggestions { get; set; } +} diff --git a/Codacy.Api/Models/HealthCheck.cs b/Codacy.Api/Models/HealthCheck.cs new file mode 100644 index 0000000..e691693 --- /dev/null +++ b/Codacy.Api/Models/HealthCheck.cs @@ -0,0 +1,10 @@ +namespace Codacy.Api.Models; + +/// +/// Health check +/// +public class HealthCheck +{ + /// Message + public required string Message { get; set; } +} diff --git a/Codacy.Api/Models/HealthCheckResponse.cs b/Codacy.Api/Models/HealthCheckResponse.cs new file mode 100644 index 0000000..025930b --- /dev/null +++ b/Codacy.Api/Models/HealthCheckResponse.cs @@ -0,0 +1,10 @@ +namespace Codacy.Api.Models; + +/// +/// Health check response +/// +public class HealthCheckResponse +{ + /// Health check + public required HealthCheck Data { get; set; } +} diff --git a/Codacy.Api/Models/HeartbeatRequest.cs b/Codacy.Api/Models/HeartbeatRequest.cs new file mode 100644 index 0000000..a5bbcb9 --- /dev/null +++ b/Codacy.Api/Models/HeartbeatRequest.cs @@ -0,0 +1,10 @@ +namespace Codacy.Api.Models; + +/// +/// Request body to send a heartbeat +/// +public class HeartbeatRequest +{ + /// True if the user was active in the last heartbeat interval + public required bool WasActive { get; set; } +} diff --git a/Codacy.Api/Models/HeartbeatResponse.cs b/Codacy.Api/Models/HeartbeatResponse.cs new file mode 100644 index 0000000..96119b4 --- /dev/null +++ b/Codacy.Api/Models/HeartbeatResponse.cs @@ -0,0 +1,16 @@ +namespace Codacy.Api.Models; + +/// +/// Heartbeat response +/// +public class HeartbeatResponse +{ + /// Server time of the last activity of the user + public required DateTimeOffset LastActivity { get; set; } + + /// Time in milliseconds until the session expires due to inactivity + public required long IdleExpiresIn { get; set; } + + /// Time in milliseconds until the session absolute timeout expires + public required long AbsoluteExpiresIn { get; set; } +} diff --git a/Codacy.Api/Models/IgnoredFile.cs b/Codacy.Api/Models/IgnoredFile.cs new file mode 100644 index 0000000..e3dbcb1 --- /dev/null +++ b/Codacy.Api/Models/IgnoredFile.cs @@ -0,0 +1,10 @@ +namespace Codacy.Api.Models; + +/// +/// Ignored file +/// +public class IgnoredFile +{ + /// Relative path of the file in the repository + public required string Filepath { get; set; } +} diff --git a/Codacy.Api/Models/IgnoredFileListResponse.cs b/Codacy.Api/Models/IgnoredFileListResponse.cs new file mode 100644 index 0000000..7a0deee --- /dev/null +++ b/Codacy.Api/Models/IgnoredFileListResponse.cs @@ -0,0 +1,16 @@ +namespace Codacy.Api.Models; + +/// +/// Ignored file list response +/// +public class IgnoredFileListResponse +{ + /// If the repository has a configuration file that controls which files are ignored + public required bool HasCodacyConfigurationFile { get; set; } + + /// Ignored files + public required List Data { get; set; } + + /// Pagination info + public PaginationInfo? Pagination { get; set; } +} diff --git a/Codacy.Api/Models/ImageSummary.cs b/Codacy.Api/Models/ImageSummary.cs new file mode 100644 index 0000000..57d43c9 --- /dev/null +++ b/Codacy.Api/Models/ImageSummary.cs @@ -0,0 +1,22 @@ +namespace Codacy.Api.Models; + +/// +/// Summary of a Docker image +/// +public class ImageSummary +{ + /// The name of the Docker image + public required string ImageName { get; set; } + + /// The most recently uploaded tag for this image + public string? LatestTag { get; set; } + + /// When the last SBOM was uploaded + public DateTimeOffset? LastSbomUploaded { get; set; } + + /// When the last SBOM was generated + public DateTimeOffset? LastSbomGenerated { get; set; } + + /// Number of tags uploaded for this image + public required int TagCount { get; set; } +} diff --git a/Codacy.Api/Models/ImageTagSummary.cs b/Codacy.Api/Models/ImageTagSummary.cs new file mode 100644 index 0000000..6663c6f --- /dev/null +++ b/Codacy.Api/Models/ImageTagSummary.cs @@ -0,0 +1,34 @@ +namespace Codacy.Api.Models; + +/// +/// Summary of a Docker image tag +/// +public class ImageTagSummary +{ + /// The name of the Docker image + public required string ImageName { get; set; } + + /// Tag of the Docker image + public required string Tag { get; set; } + + /// Environment where the image is deployed + public string? Environment { get; set; } + + /// The repository id associated with this image tag + public long? RepositoryId { get; set; } + + /// The repository name associated with this image tag + public string? RepositoryName { get; set; } + + /// When the SBOM for this image tag was generated + public required DateTimeOffset GeneratedAt { get; set; } + + /// When the SBOM was uploaded + public required DateTimeOffset UploadedAt { get; set; } + + /// Deprecated upstream, use LastAnalysedAt instead + public DateTimeOffset? ScanStatus { get; set; } + + /// When this image tag was last analysed + public DateTimeOffset? LastAnalysedAt { get; set; } +} diff --git a/Codacy.Api/Models/ImagesUsage.cs b/Codacy.Api/Models/ImagesUsage.cs new file mode 100644 index 0000000..20a0ff0 --- /dev/null +++ b/Codacy.Api/Models/ImagesUsage.cs @@ -0,0 +1,13 @@ +namespace Codacy.Api.Models; + +/// +/// Image tag usage against the organization limit +/// +public class ImagesUsage +{ + /// Number of image tags uploaded across the organization, counted against the limit + public required int ImageTags { get; set; } + + /// Maximum number of image tags allowed for the organization + public required int Limit { get; set; } +} diff --git a/Codacy.Api/Models/JiraIntegration.cs b/Codacy.Api/Models/JiraIntegration.cs new file mode 100644 index 0000000..9e3d798 --- /dev/null +++ b/Codacy.Api/Models/JiraIntegration.cs @@ -0,0 +1,29 @@ +using System.Text.Json.Serialization; + +namespace Codacy.Api.Models; + +/// +/// Details of a Jira integration for the security and risk management feature +/// +public class JiraIntegration +{ + /// Codacy organization ID + [JsonPropertyName("organization_id")] + public required long OrganizationId { get; set; } + + /// Jira cloud ID of the organization + [JsonPropertyName("instance_id")] + public required string InstanceId { get; set; } + + /// Name of the Jira instance that Codacy has access to + [JsonPropertyName("instance_name")] + public required string InstanceName { get; set; } + + /// Creation date + [JsonPropertyName("created_at")] + public required DateTimeOffset CreatedAt { get; set; } + + /// Last update date + [JsonPropertyName("updated_at")] + public required DateTimeOffset UpdatedAt { get; set; } +} diff --git a/Codacy.Api/Models/JiraIntegrationResponse.cs b/Codacy.Api/Models/JiraIntegrationResponse.cs new file mode 100644 index 0000000..2fd3880 --- /dev/null +++ b/Codacy.Api/Models/JiraIntegrationResponse.cs @@ -0,0 +1,10 @@ +namespace Codacy.Api.Models; + +/// +/// A response with a Jira integration +/// +public class JiraIntegrationResponse +{ + /// The Jira integration + public required JiraIntegration Data { get; set; } +} diff --git a/Codacy.Api/Models/JiraProject.cs b/Codacy.Api/Models/JiraProject.cs new file mode 100644 index 0000000..b2a2eae --- /dev/null +++ b/Codacy.Api/Models/JiraProject.cs @@ -0,0 +1,19 @@ +namespace Codacy.Api.Models; + +/// +/// A Jira project +/// +public class JiraProject +{ + /// Project identifier + public required long Id { get; set; } + + /// Project key + public required string Key { get; set; } + + /// Project name + public required string Name { get; set; } + + /// Project avatar URL + public required string AvatarUrl { get; set; } +} diff --git a/Codacy.Api/Models/JiraProjectIssueField.cs b/Codacy.Api/Models/JiraProjectIssueField.cs new file mode 100644 index 0000000..415ec31 --- /dev/null +++ b/Codacy.Api/Models/JiraProjectIssueField.cs @@ -0,0 +1,22 @@ +namespace Codacy.Api.Models; + +/// +/// A possible field for a Jira project issue type +/// +public class JiraProjectIssueField +{ + /// Field identifier + public required string FieldId { get; set; } + + /// Field name + public required string Name { get; set; } + + /// Field key + public required string Key { get; set; } + + /// True if the field is required + public required bool Required { get; set; } + + /// True if the field has a default value + public required bool HasDefaultValue { get; set; } +} diff --git a/Codacy.Api/Models/JiraProjectIssueFieldsResponse.cs b/Codacy.Api/Models/JiraProjectIssueFieldsResponse.cs new file mode 100644 index 0000000..afe1cc4 --- /dev/null +++ b/Codacy.Api/Models/JiraProjectIssueFieldsResponse.cs @@ -0,0 +1,13 @@ +namespace Codacy.Api.Models; + +/// +/// A response with a list of possible fields for a Jira project issue type +/// +public class JiraProjectIssueFieldsResponse +{ + /// The fields + public required List Data { get; set; } + + /// Pagination info + public PaginationInfoLong? Pagination { get; set; } +} diff --git a/Codacy.Api/Models/JiraProjectIssueType.cs b/Codacy.Api/Models/JiraProjectIssueType.cs new file mode 100644 index 0000000..3084430 --- /dev/null +++ b/Codacy.Api/Models/JiraProjectIssueType.cs @@ -0,0 +1,19 @@ +namespace Codacy.Api.Models; + +/// +/// An issue type of a Jira project +/// +public class JiraProjectIssueType +{ + /// Issue type identifier + public required long Id { get; set; } + + /// Issue type name + public required string Name { get; set; } + + /// True if the issue type is a subtask + public required bool IsSubtask { get; set; } + + /// Icon URL + public string? IconUrl { get; set; } +} diff --git a/Codacy.Api/Models/JiraProjectIssueTypesResponse.cs b/Codacy.Api/Models/JiraProjectIssueTypesResponse.cs new file mode 100644 index 0000000..e1a7d64 --- /dev/null +++ b/Codacy.Api/Models/JiraProjectIssueTypesResponse.cs @@ -0,0 +1,13 @@ +namespace Codacy.Api.Models; + +/// +/// A response with a list of issue types for a Jira project +/// +public class JiraProjectIssueTypesResponse +{ + /// The issue types + public required List Data { get; set; } + + /// Pagination info + public PaginationInfoLong? Pagination { get; set; } +} diff --git a/Codacy.Api/Models/JiraTicket.cs b/Codacy.Api/Models/JiraTicket.cs new file mode 100644 index 0000000..09c39b7 --- /dev/null +++ b/Codacy.Api/Models/JiraTicket.cs @@ -0,0 +1,25 @@ +namespace Codacy.Api.Models; + +/// +/// A Jira ticket +/// +public class JiraTicket +{ + /// Ticket identifier + public required string Id { get; set; } + + /// Ticket key + public required string Key { get; set; } + + /// Ticket summary + public required string Summary { get; set; } + + /// Ticket assignee + public required string Assignee { get; set; } + + /// Link to the ticket + public required string Link { get; set; } + + /// Ticket status + public required JiraTicketStatus Status { get; set; } +} diff --git a/Codacy.Api/Models/JiraTicketStatus.cs b/Codacy.Api/Models/JiraTicketStatus.cs new file mode 100644 index 0000000..aa0dae9 --- /dev/null +++ b/Codacy.Api/Models/JiraTicketStatus.cs @@ -0,0 +1,16 @@ +namespace Codacy.Api.Models; + +/// +/// Status of a Jira ticket +/// +public class JiraTicketStatus +{ + /// Status key + public required string Key { get; set; } + + /// Status labels + public required List Labels { get; set; } + + /// Status color + public required string Color { get; set; } +} diff --git a/Codacy.Api/Models/JoinModeRequest.cs b/Codacy.Api/Models/JoinModeRequest.cs new file mode 100644 index 0000000..c6a0c54 --- /dev/null +++ b/Codacy.Api/Models/JoinModeRequest.cs @@ -0,0 +1,10 @@ +namespace Codacy.Api.Models; + +/// +/// Request body to update the join mode +/// +public class JoinModeRequest +{ + /// Join mode + public required JoinMode JoinMode { get; set; } +} diff --git a/Codacy.Api/Models/Language.cs b/Codacy.Api/Models/Language.cs new file mode 100644 index 0000000..ea01489 --- /dev/null +++ b/Codacy.Api/Models/Language.cs @@ -0,0 +1,10 @@ +namespace Codacy.Api.Models; + +/// +/// Language information +/// +public class Language +{ + /// Name of the language + public required string Name { get; set; } +} diff --git a/Codacy.Api/Models/LanguageFileExtension.cs b/Codacy.Api/Models/LanguageFileExtension.cs new file mode 100644 index 0000000..4e514bb --- /dev/null +++ b/Codacy.Api/Models/LanguageFileExtension.cs @@ -0,0 +1,16 @@ +namespace Codacy.Api.Models; + +/// +/// A language supported by Codacy tools and its file extensions +/// +public class LanguageFileExtension +{ + /// The language name + public required string Name { get; set; } + + /// The default file extensions for this language + public required List FileExtensions { get; set; } + + /// Specific files that should be considered for this language + public required List Files { get; set; } +} diff --git a/Codacy.Api/Models/LanguageListResponse.cs b/Codacy.Api/Models/LanguageListResponse.cs new file mode 100644 index 0000000..8a98517 --- /dev/null +++ b/Codacy.Api/Models/LanguageListResponse.cs @@ -0,0 +1,10 @@ +namespace Codacy.Api.Models; + +/// +/// List of languages supported by available tools +/// +public class LanguageListResponse +{ + /// Languages + public required List Data { get; set; } +} diff --git a/Codacy.Api/Models/LeaveOrgCheckResult.cs b/Codacy.Api/Models/LeaveOrgCheckResult.cs new file mode 100644 index 0000000..e833e88 --- /dev/null +++ b/Codacy.Api/Models/LeaveOrgCheckResult.cs @@ -0,0 +1,16 @@ +namespace Codacy.Api.Models; + +/// +/// Informs if the user can leave the organization and if not, why +/// +public class LeaveOrgCheckResult +{ + /// True if user can leave the organization + public required bool CanLeave { get; set; } + + /// Message + public required string Message { get; set; } + + /// Reason the user cannot leave + public LeaveOrgProblem? Reason { get; set; } +} diff --git a/Codacy.Api/Models/LeaveOrgProblem.cs b/Codacy.Api/Models/LeaveOrgProblem.cs new file mode 100644 index 0000000..045f413 --- /dev/null +++ b/Codacy.Api/Models/LeaveOrgProblem.cs @@ -0,0 +1,13 @@ +namespace Codacy.Api.Models; + +/// +/// Problem preventing a user from leaving an organization +/// +public class LeaveOrgProblem +{ + /// Suggested actions + public required List Actions { get; set; } + + /// A stable identifier for a problem + public required string Code { get; set; } +} diff --git a/Codacy.Api/Models/License.cs b/Codacy.Api/Models/License.cs new file mode 100644 index 0000000..c6c9a48 --- /dev/null +++ b/Codacy.Api/Models/License.cs @@ -0,0 +1,25 @@ +namespace Codacy.Api.Models; + +/// +/// Request body to generate a license +/// +public class License +{ + /// Number of seats + public required int NumberOfSeats { get; set; } + + /// Email + public required string Email { get; set; } + + /// Expiration date + public required DateTimeOffset ExpirationDate { get; set; } + + /// Inactivity threshold + public int? InactivityThreshold { get; set; } + + /// Whether to automatically add authors + public bool? AutoAddAuthors { get; set; } + + /// Whether to allow seats overflow + public bool? AllowSeatsOverflow { get; set; } +} diff --git a/Codacy.Api/Models/LicenseResponse.cs b/Codacy.Api/Models/LicenseResponse.cs new file mode 100644 index 0000000..2b0d5dc --- /dev/null +++ b/Codacy.Api/Models/LicenseResponse.cs @@ -0,0 +1,10 @@ +namespace Codacy.Api.Models; + +/// +/// License response +/// +public class LicenseResponse +{ + /// Generated license + public required string Data { get; set; } +} diff --git a/Codacy.Api/Models/LicenseRiskCategory.cs b/Codacy.Api/Models/LicenseRiskCategory.cs new file mode 100644 index 0000000..fb8be21 --- /dev/null +++ b/Codacy.Api/Models/LicenseRiskCategory.cs @@ -0,0 +1,31 @@ +using System.Text.Json.Serialization; + +namespace Codacy.Api.Models; + +/// +/// The risk category of a license +/// +[JsonConverter(typeof(JsonStringEnumConverter))] +public enum LicenseRiskCategory +{ + /// Forbidden + Forbidden, + + /// Restricted + Restricted, + + /// Reciprocal + Reciprocal, + + /// Notice + Notice, + + /// Permissive + Permissive, + + /// Unencumbered + Unencumbered, + + /// Unknown + Unknown +} diff --git a/Codacy.Api/Models/LicensesDetails.cs b/Codacy.Api/Models/LicensesDetails.cs new file mode 100644 index 0000000..00ec710 --- /dev/null +++ b/Codacy.Api/Models/LicensesDetails.cs @@ -0,0 +1,25 @@ +namespace Codacy.Api.Models; + +/// +/// Detailed information about a license +/// +public class LicensesDetails +{ + /// The name of the license + public string? Name { get; set; } + + /// The official page of the license + public string? Url { get; set; } + + /// Whether the license is OSI approved + public bool? IsOsiApproved { get; set; } + + /// Whether the license is FSF libre + public bool? IsFsfLibre { get; set; } + + /// The license risk category + public LicenseRiskCategory? RiskCategory { get; set; } + + /// Whether the license details were derived by AI + public bool? IsDerivedByAi { get; set; } +} diff --git a/Codacy.Api/Models/ListImagesResponse.cs b/Codacy.Api/Models/ListImagesResponse.cs new file mode 100644 index 0000000..e90b48c --- /dev/null +++ b/Codacy.Api/Models/ListImagesResponse.cs @@ -0,0 +1,16 @@ +namespace Codacy.Api.Models; + +/// +/// Response listing Docker images for an organization +/// +public class ListImagesResponse +{ + /// Pagination info + public required PaginationInfo Pagination { get; set; } + + /// The images + public required List Data { get; set; } + + /// Image tag usage + public required ImagesUsage Usage { get; set; } +} diff --git a/Codacy.Api/Models/MembershipPrivileges.cs b/Codacy.Api/Models/MembershipPrivileges.cs new file mode 100644 index 0000000..6177a0f --- /dev/null +++ b/Codacy.Api/Models/MembershipPrivileges.cs @@ -0,0 +1,22 @@ +using System.Text.Json.Serialization; + +namespace Codacy.Api.Models; + +/// +/// Minimum permission level for organization members +/// +[JsonConverter(typeof(JsonStringEnumConverter))] +public enum MembershipPrivileges +{ + /// Repository admin + [JsonStringEnumMemberName("RepoAdmin")] + RepoAdmin, + + /// Repository write + [JsonStringEnumMemberName("RepoWrite")] + RepoWrite, + + /// Repository read + [JsonStringEnumMemberName("RepoRead")] + RepoRead +} diff --git a/Codacy.Api/Models/MembershipPrivilegesBody.cs b/Codacy.Api/Models/MembershipPrivilegesBody.cs new file mode 100644 index 0000000..cd275bf --- /dev/null +++ b/Codacy.Api/Models/MembershipPrivilegesBody.cs @@ -0,0 +1,10 @@ +namespace Codacy.Api.Models; + +/// +/// Minimum permission level regarding configuring patterns, configuring which files to analyze and other analysis settings +/// +public class MembershipPrivilegesBody +{ + /// Minimum permission + public MembershipPrivileges? Permission { get; set; } +} diff --git a/Codacy.Api/Models/MetricFilter.cs b/Codacy.Api/Models/MetricFilter.cs new file mode 100644 index 0000000..c590dd3 --- /dev/null +++ b/Codacy.Api/Models/MetricFilter.cs @@ -0,0 +1,16 @@ +using System.Text.Json.Serialization; + +namespace Codacy.Api.Models; + +/// +/// Filter for an organization metric query +/// +public class MetricFilter +{ + /// Entities to include + public required EntityFilter EntityFilter { get; set; } + + /// Dimension filters + [JsonPropertyName("dimensionsFilter")] + public List? Dimensions { get; set; } +} diff --git a/Codacy.Api/Models/MetricGroup.cs b/Codacy.Api/Models/MetricGroup.cs new file mode 100644 index 0000000..7e0e1e2 --- /dev/null +++ b/Codacy.Api/Models/MetricGroup.cs @@ -0,0 +1,16 @@ +namespace Codacy.Api.Models; + +/// +/// Group that a metric value belongs to +/// +public class MetricGroup +{ + /// Organization + public string? Organization { get; set; } + + /// Repository + public string? Repository { get; set; } + + /// Dimension values + public List? Dimensions { get; set; } +} diff --git a/Codacy.Api/Models/MetricGroupBy.cs b/Codacy.Api/Models/MetricGroupBy.cs new file mode 100644 index 0000000..0f1e63f --- /dev/null +++ b/Codacy.Api/Models/MetricGroupBy.cs @@ -0,0 +1,16 @@ +namespace Codacy.Api.Models; + +/// +/// How to group metric values +/// +public class MetricGroupBy +{ + /// Values can be organization, repository, or a dimension type that depends on the metric + public required List GroupBy { get; set; } + + /// Sort direction + public string? SortDirection { get; set; } + + /// Maximum number of groups + public int? Limit { get; set; } +} diff --git a/Codacy.Api/Models/MetricPeriod.cs b/Codacy.Api/Models/MetricPeriod.cs new file mode 100644 index 0000000..aeb9afc --- /dev/null +++ b/Codacy.Api/Models/MetricPeriod.cs @@ -0,0 +1,22 @@ +using System.Text.Json.Serialization; + +namespace Codacy.Api.Models; + +/// +/// Time granularity of metric values +/// +[JsonConverter(typeof(JsonStringEnumConverter))] +public enum MetricPeriod +{ + /// Daily + [JsonStringEnumMemberName("day")] + Day, + + /// Weekly + [JsonStringEnumMemberName("week")] + Week, + + /// Monthly + [JsonStringEnumMemberName("month")] + Month +} diff --git a/Codacy.Api/Models/MetricValueResponse.cs b/Codacy.Api/Models/MetricValueResponse.cs new file mode 100644 index 0000000..9fac881 --- /dev/null +++ b/Codacy.Api/Models/MetricValueResponse.cs @@ -0,0 +1,22 @@ +namespace Codacy.Api.Models; + +/// +/// Response containing a metric value +/// +public class MetricValueResponse +{ + /// Metric value + public required MetricValue Data { get; set; } +} + +/// +/// Value of a metric +/// +public class MetricValue +{ + /// Value + public required double Value { get; set; } + + /// Latest value + public double? LatestValue { get; set; } +} diff --git a/Codacy.Api/Models/MetricsFilter.cs b/Codacy.Api/Models/MetricsFilter.cs new file mode 100644 index 0000000..3853ec4 --- /dev/null +++ b/Codacy.Api/Models/MetricsFilter.cs @@ -0,0 +1,10 @@ +namespace Codacy.Api.Models; + +/// +/// Selects the metrics to start collecting +/// +public class MetricsFilter +{ + /// Names of the metrics + public required List Metrics { get; set; } +} diff --git a/Codacy.Api/Models/MetricsTool.cs b/Codacy.Api/Models/MetricsTool.cs new file mode 100644 index 0000000..95e241e --- /dev/null +++ b/Codacy.Api/Models/MetricsTool.cs @@ -0,0 +1,13 @@ +namespace Codacy.Api.Models; + +/// +/// Codacy tool that calculates metrics on projects +/// +public class MetricsTool +{ + /// Docker image used to launch the tool + public required string DockerImage { get; set; } + + /// Languages that the tool supports + public required List Languages { get; set; } +} diff --git a/Codacy.Api/Models/MetricsToolListResponse.cs b/Codacy.Api/Models/MetricsToolListResponse.cs new file mode 100644 index 0000000..5152639 --- /dev/null +++ b/Codacy.Api/Models/MetricsToolListResponse.cs @@ -0,0 +1,10 @@ +namespace Codacy.Api.Models; + +/// +/// List of metrics tools +/// +public class MetricsToolListResponse +{ + /// Metrics tools + public required List Data { get; set; } +} diff --git a/Codacy.Api/Models/OpenFindingsCount.cs b/Codacy.Api/Models/OpenFindingsCount.cs new file mode 100644 index 0000000..3dcd594 --- /dev/null +++ b/Codacy.Api/Models/OpenFindingsCount.cs @@ -0,0 +1,13 @@ +namespace Codacy.Api.Models; + +/// +/// The open findings count for a given severity +/// +public class OpenFindingsCount +{ + /// The severity of the findings + public required string Severity { get; set; } + + /// The number of open findings + public required int Open { get; set; } +} diff --git a/Codacy.Api/Models/OrganizationOnboardingProgressResponse.cs b/Codacy.Api/Models/OrganizationOnboardingProgressResponse.cs new file mode 100644 index 0000000..8af6950 --- /dev/null +++ b/Codacy.Api/Models/OrganizationOnboardingProgressResponse.cs @@ -0,0 +1,10 @@ +namespace Codacy.Api.Models; + +/// +/// Onboarding progress response +/// +public class OrganizationOnboardingProgressResponse +{ + /// Completeness status of each onboarding step + public required List Data { get; set; } +} diff --git a/Codacy.Api/Models/OrganizationOnboardingStep.cs b/Codacy.Api/Models/OrganizationOnboardingStep.cs new file mode 100644 index 0000000..46b66fe --- /dev/null +++ b/Codacy.Api/Models/OrganizationOnboardingStep.cs @@ -0,0 +1,13 @@ +namespace Codacy.Api.Models; + +/// +/// Onboarding step status +/// +public class OrganizationOnboardingStep +{ + /// Identifier of the onboarding step + public required string Step { get; set; } + + /// Whether the step is completed + public required bool IsCompleted { get; set; } +} diff --git a/Codacy.Api/Models/OrganizationReadyMetricsResponse.cs b/Codacy.Api/Models/OrganizationReadyMetricsResponse.cs new file mode 100644 index 0000000..b1057b9 --- /dev/null +++ b/Codacy.Api/Models/OrganizationReadyMetricsResponse.cs @@ -0,0 +1,31 @@ +namespace Codacy.Api.Models; + +/// +/// Metrics that are ready for an organization +/// +public class OrganizationReadyMetricsResponse +{ + /// Ready metrics + public required OrganizationReadyMetrics Data { get; set; } +} + +/// +/// Ready metrics for an organization +/// +public class OrganizationReadyMetrics +{ + /// Organization identifier + public required long OrganizationId { get; set; } + + /// Git provider + public required Provider Provider { get; set; } + + /// The name of the organization to which the results belong + public required string OrganizationName { get; set; } + + /// Names of the metrics that are ready + public required List ReadyMetrics { get; set; } + + /// When data collection started + public DateTimeOffset? StartedAt { get; set; } +} diff --git a/Codacy.Api/Models/PaginationInfoLong.cs b/Codacy.Api/Models/PaginationInfoLong.cs new file mode 100644 index 0000000..227ec9c --- /dev/null +++ b/Codacy.Api/Models/PaginationInfoLong.cs @@ -0,0 +1,16 @@ +namespace Codacy.Api.Models; + +/// +/// Cursor-based pagination information with a 64-bit total +/// +public class PaginationInfoLong +{ + /// Cursor to request the next batch of results + public string? Cursor { get; set; } + + /// Maximum number of items returned + public int? Limit { get; set; } + + /// Total number of items returned + public long? Total { get; set; } +} diff --git a/Codacy.Api/Models/Pattern.cs b/Codacy.Api/Models/Pattern.cs new file mode 100644 index 0000000..b74be96 --- /dev/null +++ b/Codacy.Api/Models/Pattern.cs @@ -0,0 +1,40 @@ +namespace Codacy.Api.Models; + +/// +/// Code pattern that a Codacy tool can use to find issues +/// +public class Pattern : PatternDetails +{ + /// Short description of the code pattern + public string? Description { get; set; } + + /// Full description of the code pattern, in CommonMark + public string? Explanation { get; set; } + + /// True if the code pattern is on by default for new repositories + public required bool Enabled { get; set; } + + /// Languages that the code pattern supports + public List? Languages { get; set; } + + /// Average time to fix an issue detected by the code pattern, in minutes + public int? TimeToFix { get; set; } + + /// Parameters of the code pattern + public required List Parameters { get; set; } + + /// Rationale for the pattern + public string? Rationale { get; set; } + + /// Suggested solution for the pattern + public string? Solution { get; set; } + + /// Good examples for the pattern + public List? GoodExamples { get; set; } + + /// Bad examples for the pattern + public List? BadExamples { get; set; } + + /// Tags associated with the pattern + public List? Tags { get; set; } +} diff --git a/Codacy.Api/Models/PatternListResponse.cs b/Codacy.Api/Models/PatternListResponse.cs new file mode 100644 index 0000000..fbccd9c --- /dev/null +++ b/Codacy.Api/Models/PatternListResponse.cs @@ -0,0 +1,13 @@ +namespace Codacy.Api.Models; + +/// +/// Paginated list of tool patterns +/// +public class PatternListResponse +{ + /// Patterns + public required List Data { get; set; } + + /// Pagination info + public PaginationInfo? Pagination { get; set; } +} diff --git a/Codacy.Api/Models/PatternParameter.cs b/Codacy.Api/Models/PatternParameter.cs new file mode 100644 index 0000000..454871e --- /dev/null +++ b/Codacy.Api/Models/PatternParameter.cs @@ -0,0 +1,16 @@ +namespace Codacy.Api.Models; + +/// +/// Parameter to configure a code pattern +/// +public class PatternParameter +{ + /// Name of the parameter + public required string Name { get; set; } + + /// Description of the parameter + public string? Description { get; set; } + + /// Default value of the parameter + public required string Default { get; set; } +} diff --git a/Codacy.Api/Models/PatternResponse.cs b/Codacy.Api/Models/PatternResponse.cs new file mode 100644 index 0000000..168b1b5 --- /dev/null +++ b/Codacy.Api/Models/PatternResponse.cs @@ -0,0 +1,10 @@ +namespace Codacy.Api.Models; + +/// +/// Response containing a single tool pattern +/// +public class PatternResponse +{ + /// Pattern + public required Pattern Data { get; set; } +} diff --git a/Codacy.Api/Models/PaymentPlan.cs b/Codacy.Api/Models/PaymentPlan.cs new file mode 100644 index 0000000..790a631 --- /dev/null +++ b/Codacy.Api/Models/PaymentPlan.cs @@ -0,0 +1,28 @@ +namespace Codacy.Api.Models; + +/// +/// Payment plan +/// +public class PaymentPlan +{ + /// Whether the plan is premium + public required bool IsPremium { get; set; } + + /// Plan model + public required PaymentPlanModel Model { get; set; } + + /// Plan code + public required string Code { get; set; } + + /// Whether the plan is billed monthly + public required bool Monthly { get; set; } + + /// Price + public required long Price { get; set; } + + /// Whether the plan is priced per user + public required bool PricedPerUser { get; set; } + + /// Plan code for the same tier with opposite billing period (monthly or yearly) + public string? AlternatePeriodCode { get; set; } +} diff --git a/Codacy.Api/Models/PaymentPlanModel.cs b/Codacy.Api/Models/PaymentPlanModel.cs new file mode 100644 index 0000000..c3e38ae --- /dev/null +++ b/Codacy.Api/Models/PaymentPlanModel.cs @@ -0,0 +1,18 @@ +using System.Text.Json.Serialization; + +namespace Codacy.Api.Models; + +/// +/// Payment plan model +/// +[JsonConverter(typeof(JsonStringEnumConverter))] +public enum PaymentPlanModel +{ + /// Auto + [JsonStringEnumMemberName("Auto")] + Auto, + + /// Manual + [JsonStringEnumMemberName("Manual")] + Manual +} diff --git a/Codacy.Api/Models/PaymentPlansResponse.cs b/Codacy.Api/Models/PaymentPlansResponse.cs new file mode 100644 index 0000000..8e95119 --- /dev/null +++ b/Codacy.Api/Models/PaymentPlansResponse.cs @@ -0,0 +1,10 @@ +namespace Codacy.Api.Models; + +/// +/// Payment plans response +/// +public class PaymentPlansResponse +{ + /// Payment plans + public required CodacyPaymentPlans Data { get; set; } +} diff --git a/Codacy.Api/Models/PeriodGroupMetricFilterBody.cs b/Codacy.Api/Models/PeriodGroupMetricFilterBody.cs new file mode 100644 index 0000000..be3e7af --- /dev/null +++ b/Codacy.Api/Models/PeriodGroupMetricFilterBody.cs @@ -0,0 +1,19 @@ +namespace Codacy.Api.Models; + +/// +/// Request for metric values for a specific period grouped by dimension +/// +public class PeriodGroupMetricFilterBody +{ + /// Metric filter + public required MetricFilter Filter { get; set; } + + /// Grouping options + public required MetricGroupBy GroupBy { get; set; } + + /// Start date of the period + public required DateTimeOffset Date { get; set; } + + /// Period granularity + public required MetricPeriod Period { get; set; } +} diff --git a/Codacy.Api/Models/PeriodGroupedMetricValuesResponse.cs b/Codacy.Api/Models/PeriodGroupedMetricValuesResponse.cs new file mode 100644 index 0000000..bfb51df --- /dev/null +++ b/Codacy.Api/Models/PeriodGroupedMetricValuesResponse.cs @@ -0,0 +1,25 @@ +namespace Codacy.Api.Models; + +/// +/// Response containing metric values grouped by dimension +/// +public class PeriodGroupedMetricValuesResponse +{ + /// Grouped metric values + public required List Data { get; set; } +} + +/// +/// Value of a metric for a group +/// +public class GroupedMetricValue +{ + /// Group + public required MetricGroup Group { get; set; } + + /// Value + public required double Value { get; set; } + + /// Latest value + public double? LatestValue { get; set; } +} diff --git a/Codacy.Api/Models/PeriodMetricFilterBody.cs b/Codacy.Api/Models/PeriodMetricFilterBody.cs new file mode 100644 index 0000000..c851611 --- /dev/null +++ b/Codacy.Api/Models/PeriodMetricFilterBody.cs @@ -0,0 +1,16 @@ +namespace Codacy.Api.Models; + +/// +/// Request for a metric value for a specific period +/// +public class PeriodMetricFilterBody +{ + /// Metric filter + public required MetricFilter Filter { get; set; } + + /// Start date of the period + public required DateTimeOffset Date { get; set; } + + /// Period granularity + public required MetricPeriod Period { get; set; } +} diff --git a/Codacy.Api/Models/PostReportSecurityItemsBody.cs b/Codacy.Api/Models/PostReportSecurityItemsBody.cs new file mode 100644 index 0000000..c7be722 --- /dev/null +++ b/Codacy.Api/Models/PostReportSecurityItemsBody.cs @@ -0,0 +1,28 @@ +namespace Codacy.Api.Models; + +/// +/// Optional filters for exporting security items as CSV. Scan types are plain strings (for example SAST) +/// +public class PostReportSecurityItemsBody +{ + /// Repository names to filter by + public List? Repositories { get; set; } + + /// Security issue priorities to filter by + public List? Priorities { get; set; } + + /// Security issue statuses to filter by + public List? Statuses { get; set; } + + /// Security categories to filter by; use _other_ for issues without a category + public List? Categories { get; set; } + + /// Scan types to filter by (for example SAST, SCA, ContainerSCA, Secrets, IaC, CICD, License, PenTesting, DAST, CSPM) + public List? ScanTypes { get; set; } + + /// Segment IDs to filter by + public List? Segments { get; set; } + + /// Text to search for in security items + public string? SearchText { get; set; } +} diff --git a/Codacy.Api/Models/ProviderIntegration.cs b/Codacy.Api/Models/ProviderIntegration.cs new file mode 100644 index 0000000..96f5873 --- /dev/null +++ b/Codacy.Api/Models/ProviderIntegration.cs @@ -0,0 +1,13 @@ +namespace Codacy.Api.Models; + +/// +/// Provider integration existing on the platform +/// +public class ProviderIntegration +{ + /// Git provider + public required Provider Provider { get; set; } + + /// Redirect URL + public required string RedirectUrl { get; set; } +} diff --git a/Codacy.Api/Models/ProviderIntegrationSettingsBody.cs b/Codacy.Api/Models/ProviderIntegrationSettingsBody.cs new file mode 100644 index 0000000..e691184 --- /dev/null +++ b/Codacy.Api/Models/ProviderIntegrationSettingsBody.cs @@ -0,0 +1,37 @@ +namespace Codacy.Api.Models; + +/// +/// Default settings for Git provider integrations with a list of available settings +/// +public class ProviderIntegrationSettingsBody +{ + /// Toggle the feature "Status checks" + public required bool CommitStatus { get; set; } + + /// Toggle the feature "Issue annotations" + public required bool PullRequestComment { get; set; } + + /// Toggle the feature "Issue summaries" + public required bool PullRequestSummary { get; set; } + + /// Toggle the feature "Coverage summary" (GitHub only) + public bool? CoverageSummary { get; set; } + + /// Toggle the feature "Suggested fixes" (GitHub only) + public bool? Suggestions { get; set; } + + /// Toggle the feature "AI-enhanced comments" + public required bool AiEnhancedComments { get; set; } + + /// Toggle the feature "AI Pull Request Reviewer" (GitHub only) + public bool? AiPullRequestReviewer { get; set; } + + /// Toggle the feature "AI Pull Request Reviewer Automatic" (GitHub only) + public bool? AiPullRequestReviewerAutomatic { get; set; } + + /// Toggle the feature "Pull Request Unified Summary" (GitHub only) + public bool? PullRequestUnifiedSummary { get; set; } + + /// List of available settings for the Git provider integration + public required List AvailableSettings { get; set; } +} diff --git a/Codacy.Api/Models/ProviderIntegrationSettingsPatchBody.cs b/Codacy.Api/Models/ProviderIntegrationSettingsPatchBody.cs new file mode 100644 index 0000000..70e0060 --- /dev/null +++ b/Codacy.Api/Models/ProviderIntegrationSettingsPatchBody.cs @@ -0,0 +1,34 @@ +namespace Codacy.Api.Models; + +/// +/// Default settings for Git provider integrations +/// +public class ProviderIntegrationSettingsPatchBody +{ + /// Toggle the feature "Status checks" + public bool? CommitStatus { get; set; } + + /// Toggle the feature "Issue annotations" + public bool? PullRequestComment { get; set; } + + /// Toggle the feature "Issue summaries" + public bool? PullRequestSummary { get; set; } + + /// Toggle the feature "Coverage summary" (GitHub only) + public bool? CoverageSummary { get; set; } + + /// Toggle the feature "Suggested fixes" (GitHub only) + public bool? Suggestions { get; set; } + + /// Toggle the feature "AI-enhanced comments" + public bool? AiEnhancedComments { get; set; } + + /// Toggle the feature "AI Pull Request Reviewer" (GitHub only) + public bool? AiPullRequestReviewer { get; set; } + + /// Toggle the feature "AI Pull Request Reviewer Automatic" (GitHub only) + public bool? AiPullRequestReviewerAutomatic { get; set; } + + /// Toggle the feature "Pull Request Unified Summary" (GitHub only) + public bool? PullRequestUnifiedSummary { get; set; } +} diff --git a/Codacy.Api/Models/QuickfixPatchResponse.cs b/Codacy.Api/Models/QuickfixPatchResponse.cs new file mode 100644 index 0000000..7a3fe03 --- /dev/null +++ b/Codacy.Api/Models/QuickfixPatchResponse.cs @@ -0,0 +1,19 @@ +namespace Codacy.Api.Models; + +/// +/// Quick fixes in patch format +/// +public class QuickfixPatchResponse +{ + /// Patch data + public required QuickfixPatchData Data { get; set; } +} + +/// +/// Quick fix patch data +/// +public class QuickfixPatchData +{ + /// Base64 encoded patch file + public required string Patch { get; set; } +} diff --git a/Codacy.Api/Models/ReadyMetricsForEnterpriseResponse.cs b/Codacy.Api/Models/ReadyMetricsForEnterpriseResponse.cs new file mode 100644 index 0000000..007bad6 --- /dev/null +++ b/Codacy.Api/Models/ReadyMetricsForEnterpriseResponse.cs @@ -0,0 +1,28 @@ +namespace Codacy.Api.Models; + +/// +/// Metrics that are ready for each organization in an enterprise +/// +public class ReadyMetricsForEnterpriseResponse +{ + /// Ready metrics per organization + public required List Data { get; set; } +} + +/// +/// Ready metrics for an organization in an enterprise +/// +public class EnterpriseReadyMetrics +{ + /// Organization identifier + public required long OrganizationId { get; set; } + + /// Organization name + public required string OrganizationName { get; set; } + + /// Names of the metrics that are ready + public required List ReadyMetrics { get; set; } + + /// When data collection started + public DateTimeOffset? StartedAt { get; set; } +} diff --git a/Codacy.Api/Models/Reason.cs b/Codacy.Api/Models/Reason.cs new file mode 100644 index 0000000..69d5844 --- /dev/null +++ b/Codacy.Api/Models/Reason.cs @@ -0,0 +1,13 @@ +namespace Codacy.Api.Models; + +/// +/// Reason with notes +/// +public class Reason +{ + /// Title + public required string Title { get; set; } + + /// Notes + public required List Notes { get; set; } +} diff --git a/Codacy.Api/Models/RepositoriesOverviewOfSbomDependency.cs b/Codacy.Api/Models/RepositoriesOverviewOfSbomDependency.cs new file mode 100644 index 0000000..a4d0bf5 --- /dev/null +++ b/Codacy.Api/Models/RepositoriesOverviewOfSbomDependency.cs @@ -0,0 +1,37 @@ +namespace Codacy.Api.Models; + +/// +/// Overview of how a dependency is used across repositories +/// +public class RepositoriesOverviewOfSbomDependency +{ + /// The dependency name + public string? Name { get; set; } + + /// The dependency full name + public required string FullName { get; set; } + + /// The purl of the dependency + public string? Purl { get; set; } + + /// The ossf score of the dependency + public double? OssfScore { get; set; } + + /// Latest version used across filtered repositories + public string? LatestVersion { get; set; } + + /// Oldest version used across filtered repositories + public string? OldestVersion { get; set; } + + /// Versions in use across repositories (not affected by filtering) + public int? TotalVersionsCount { get; set; } + + /// Versions in use across the filtered repositories + public required int FilteredVersionsCount { get; set; } + + /// Repositories using a version of this dependency (not affected by filtering) + public required int TotalRepositoriesCount { get; set; } + + /// Filtered repositories using a version of this dependency + public required int FilteredRepositoriesCount { get; set; } +} diff --git a/Codacy.Api/Models/RepositoryApiTokenCreateRequest.cs b/Codacy.Api/Models/RepositoryApiTokenCreateRequest.cs new file mode 100644 index 0000000..b011fb5 --- /dev/null +++ b/Codacy.Api/Models/RepositoryApiTokenCreateRequest.cs @@ -0,0 +1,13 @@ +namespace Codacy.Api.Models; + +/// +/// Request body for creating a repository API token +/// +public class RepositoryApiTokenCreateRequest +{ + /// A name to identify the token: alphanumeric characters and dashes, maximum 100 characters + public required string Name { get; set; } + + /// When the token expires: must be in the future and no more than one year from now + public required DateTimeOffset ExpiresAt { get; set; } +} diff --git a/Codacy.Api/Models/RepositoryApiTokensDeleteRequest.cs b/Codacy.Api/Models/RepositoryApiTokensDeleteRequest.cs new file mode 100644 index 0000000..b428ebd --- /dev/null +++ b/Codacy.Api/Models/RepositoryApiTokensDeleteRequest.cs @@ -0,0 +1,10 @@ +namespace Codacy.Api.Models; + +/// +/// Request body for deleting repository API tokens by ids +/// +public class RepositoryApiTokensDeleteRequest +{ + /// Ids of the repository API tokens to delete + public required List Ids { get; set; } +} diff --git a/Codacy.Api/Models/RepositoryCoverageReport.cs b/Codacy.Api/Models/RepositoryCoverageReport.cs new file mode 100644 index 0000000..7fb33e4 --- /dev/null +++ b/Codacy.Api/Models/RepositoryCoverageReport.cs @@ -0,0 +1,22 @@ +namespace Codacy.Api.Models; + +/// +/// Status and details of a coverage report (spec schema CoverageReport, renamed to avoid the existing CoverageReport type) +/// +public class RepositoryCoverageReport +{ + /// Commit SHA that was referenced as the target for this report + public required string TargetCommitSha { get; set; } + + /// Commit details + public CommitWithBranches? Commit { get; set; } + + /// Programming language associated with the coverage report + public string? Language { get; set; } + + /// Report creation date + public required DateTimeOffset CreatedAt { get; set; } + + /// Coverage status + public required CoverageReportStatus Status { get; set; } +} diff --git a/Codacy.Api/Models/RepositoryIdentification.cs b/Codacy.Api/Models/RepositoryIdentification.cs new file mode 100644 index 0000000..f127d68 --- /dev/null +++ b/Codacy.Api/Models/RepositoryIdentification.cs @@ -0,0 +1,13 @@ +namespace Codacy.Api.Models; + +/// +/// Identifier and name of a repository +/// +public class RepositoryIdentification +{ + /// Identifier of the repository + public required long RepositoryId { get; set; } + + /// Name of the repository + public required string Name { get; set; } +} diff --git a/Codacy.Api/Models/RepositoryIdentificationV2.cs b/Codacy.Api/Models/RepositoryIdentificationV2.cs new file mode 100644 index 0000000..eed67d7 --- /dev/null +++ b/Codacy.Api/Models/RepositoryIdentificationV2.cs @@ -0,0 +1,19 @@ +namespace Codacy.Api.Models; + +/// +/// Repository identification +/// +public class RepositoryIdentificationV2 +{ + /// Identifier of the repository + public required long RepositoryId { get; set; } + + /// Name of the repository + public required string Name { get; set; } + + /// Git provider + public required Provider Provider { get; set; } + + /// Name of the organization + public required string OrganizationName { get; set; } +} diff --git a/Codacy.Api/Models/RepositoryIntegrationSettings.cs b/Codacy.Api/Models/RepositoryIntegrationSettings.cs new file mode 100644 index 0000000..1d1a271 --- /dev/null +++ b/Codacy.Api/Models/RepositoryIntegrationSettings.cs @@ -0,0 +1,13 @@ +namespace Codacy.Api.Models; + +/// +/// Settings for Git provider integrations +/// +public class RepositoryIntegrationSettings +{ + /// Integration settings + public required ProviderIntegrationSettingsBody Settings { get; set; } + + /// Who integrated the repository + public string? IntegratedBy { get; set; } +} diff --git a/Codacy.Api/Models/RepositoryLanguage.cs b/Codacy.Api/Models/RepositoryLanguage.cs new file mode 100644 index 0000000..dd2d5df --- /dev/null +++ b/Codacy.Api/Models/RepositoryLanguage.cs @@ -0,0 +1,22 @@ +namespace Codacy.Api.Models; + +/// +/// List of supported file extensions for a specific language +/// +public class RepositoryLanguage : Language +{ + /// Default Codacy extensions for the language + public required List CodacyDefaults { get; set; } + + /// List of custom extensions for the language + public required List Extensions { get; set; } + + /// Default Codacy files for the language + public required List DefaultFiles { get; set; } + + /// Whether this language is analyzed for the repository + public required bool Enabled { get; set; } + + /// Whether Codacy detected this language in the repository (requires at least one analysis) + public required bool Detected { get; set; } +} diff --git a/Codacy.Api/Models/RepositoryLanguageResponse.cs b/Codacy.Api/Models/RepositoryLanguageResponse.cs new file mode 100644 index 0000000..ae6afb1 --- /dev/null +++ b/Codacy.Api/Models/RepositoryLanguageResponse.cs @@ -0,0 +1,10 @@ +namespace Codacy.Api.Models; + +/// +/// Repository languages response +/// +public class RepositoryLanguageResponse +{ + /// List of languages with supported extensions + public required List Languages { get; set; } +} diff --git a/Codacy.Api/Models/RepositoryLanguageUpdate.cs b/Codacy.Api/Models/RepositoryLanguageUpdate.cs new file mode 100644 index 0000000..d189459 --- /dev/null +++ b/Codacy.Api/Models/RepositoryLanguageUpdate.cs @@ -0,0 +1,13 @@ +namespace Codacy.Api.Models; + +/// +/// Update of the settings of a language +/// +public class RepositoryLanguageUpdate : Language +{ + /// Custom file extensions for the language; if left undefined the extensions are not updated + public List? Extensions { get; set; } + + /// Whether this language is analyzed for the repository; if left undefined the flag is not updated + public bool? Enabled { get; set; } +} diff --git a/Codacy.Api/Models/RepositoryLanguagesBody.cs b/Codacy.Api/Models/RepositoryLanguagesBody.cs new file mode 100644 index 0000000..d3cd5fe --- /dev/null +++ b/Codacy.Api/Models/RepositoryLanguagesBody.cs @@ -0,0 +1,10 @@ +namespace Codacy.Api.Models; + +/// +/// Request body to configure the languages of a repository +/// +public class RepositoryLanguagesBody +{ + /// List of languages for this repository + public required List Languages { get; set; } +} diff --git a/Codacy.Api/Models/RepositorySummaryOfSbomDependency.cs b/Codacy.Api/Models/RepositorySummaryOfSbomDependency.cs new file mode 100644 index 0000000..e9fc352 --- /dev/null +++ b/Codacy.Api/Models/RepositorySummaryOfSbomDependency.cs @@ -0,0 +1,25 @@ +namespace Codacy.Api.Models; + +/// +/// Summary of a repository where a given dependency is used +/// +public class RepositorySummaryOfSbomDependency +{ + /// The identifier of the repository + public required long Id { get; set; } + + /// The name of the repository + public required string Name { get; set; } + + /// The exact version of the dependency this repository is using + public string? DependencyVersion { get; set; } + + /// The highest severity of the findings for this dependency in this repository + public string? HighestFindingSeverity { get; set; } + + /// Deprecated upstream, use LicensesDetails instead + public required List Licenses { get; set; } + + /// Detailed license information for the dependency used in this repository + public required List LicensesDetails { get; set; } +} diff --git a/Codacy.Api/Models/RepositoryToolConflictsResponse.cs b/Codacy.Api/Models/RepositoryToolConflictsResponse.cs new file mode 100644 index 0000000..3fce017 --- /dev/null +++ b/Codacy.Api/Models/RepositoryToolConflictsResponse.cs @@ -0,0 +1,10 @@ +namespace Codacy.Api.Models; + +/// +/// Repository tool patterns that have conflicts +/// +public class RepositoryToolConflictsResponse +{ + /// Patterns with conflicts + public required List Data { get; set; } +} diff --git a/Codacy.Api/Models/RequestToJoin.cs b/Codacy.Api/Models/RequestToJoin.cs new file mode 100644 index 0000000..dac1a03 --- /dev/null +++ b/Codacy.Api/Models/RequestToJoin.cs @@ -0,0 +1,25 @@ +namespace Codacy.Api.Models; + +/// +/// Request to join an organization +/// +public class RequestToJoin +{ + /// Email + public required string Email { get; set; } + + /// Name + public required string Name { get; set; } + + /// Number of commits + public int? NumberOfCommits { get; set; } + + /// Number of repositories + public int? NumberOfRepositories { get; set; } + + /// Last activity + public DateTimeOffset? LastActivity { get; set; } + + /// Creation date + public required DateTimeOffset CreationDate { get; set; } +} diff --git a/Codacy.Api/Models/SbomDependenciesOverview.cs b/Codacy.Api/Models/SbomDependenciesOverview.cs new file mode 100644 index 0000000..f44ed39 --- /dev/null +++ b/Codacy.Api/Models/SbomDependenciesOverview.cs @@ -0,0 +1,19 @@ +namespace Codacy.Api.Models; + +/// +/// Overview of a search dependencies request +/// +public class SbomDependenciesOverview +{ + /// Total repositories with dependency information (not affected by filtering) + public required int TotalRepositoriesCount { get; set; } + + /// Filtered repositories with dependency information + public required int FilteredRepositoriesCount { get; set; } + + /// Total dependencies across repositories (not affected by filtering) + public required long TotalDependenciesCount { get; set; } + + /// Filtered dependencies across repositories + public required long FilteredDependenciesCount { get; set; } +} diff --git a/Codacy.Api/Models/SbomDependencySummary.cs b/Codacy.Api/Models/SbomDependencySummary.cs new file mode 100644 index 0000000..75a0970 --- /dev/null +++ b/Codacy.Api/Models/SbomDependencySummary.cs @@ -0,0 +1,28 @@ +namespace Codacy.Api.Models; + +/// +/// Summary of a dependency +/// +public class SbomDependencySummary +{ + /// The full name of the dependency + public required string FullName { get; set; } + + /// The purl of the dependency + public string? Purl { get; set; } + + /// The ossf score of the dependency + public double? OssfScore { get; set; } + + /// The number of repositories where a version of this dependency is used + public required int RepositoriesCount { get; set; } + + /// The number of versions this dependency has across repositories + public required int VersionsCount { get; set; } + + /// Open findings count, per severity, found for this dependency + public required List Findings { get; set; } + + /// Detailed license information for this dependency + public required List LicensesDetails { get; set; } +} diff --git a/Codacy.Api/Models/SbomPresignResponse.cs b/Codacy.Api/Models/SbomPresignResponse.cs new file mode 100644 index 0000000..500a0bf --- /dev/null +++ b/Codacy.Api/Models/SbomPresignResponse.cs @@ -0,0 +1,10 @@ +namespace Codacy.Api.Models; + +/// +/// Response containing a presigned URL to download the repository SBOM +/// +public class SbomPresignResponse +{ + /// Presigned S3 URL to download the SBOM JSON + public required Uri Url { get; set; } +} diff --git a/Codacy.Api/Models/SearchRepositoriesOfSbomDependencyBody.cs b/Codacy.Api/Models/SearchRepositoriesOfSbomDependencyBody.cs new file mode 100644 index 0000000..7cad259 --- /dev/null +++ b/Codacy.Api/Models/SearchRepositoriesOfSbomDependencyBody.cs @@ -0,0 +1,13 @@ +namespace Codacy.Api.Models; + +/// +/// Request body for searching the repositories where a dependency is used +/// +public class SearchRepositoriesOfSbomDependencyBody +{ + /// The full name of the dependency to search for + public required string DependencyFullName { get; set; } + + /// Repository names to filter by + public List? RepositoriesFilter { get; set; } +} diff --git a/Codacy.Api/Models/SearchRepositoriesOfSbomDependencyResponse.cs b/Codacy.Api/Models/SearchRepositoriesOfSbomDependencyResponse.cs new file mode 100644 index 0000000..2271ac4 --- /dev/null +++ b/Codacy.Api/Models/SearchRepositoriesOfSbomDependencyResponse.cs @@ -0,0 +1,16 @@ +namespace Codacy.Api.Models; + +/// +/// Response body for searching the repositories where a given dependency is used +/// +public class SearchRepositoriesOfSbomDependencyResponse +{ + /// Pagination info + public required PaginationInfo Pagination { get; set; } + + /// The matching repositories + public required List Data { get; set; } + + /// Overview of the dependency usage + public required RepositoriesOverviewOfSbomDependency Overview { get; set; } +} diff --git a/Codacy.Api/Models/SearchSbomDependenciesBody.cs b/Codacy.Api/Models/SearchSbomDependenciesBody.cs new file mode 100644 index 0000000..65ef8ce --- /dev/null +++ b/Codacy.Api/Models/SearchSbomDependenciesBody.cs @@ -0,0 +1,22 @@ +namespace Codacy.Api.Models; + +/// +/// Request body for searching dependencies +/// +public class SearchSbomDependenciesBody +{ + /// Text search query matching SBOM component fields (purl, full_name) + public string? Text { get; set; } + + /// Repository names to filter by + public List? Repositories { get; set; } + + /// Segment ids to filter by + public List? Segments { get; set; } + + /// Finding severities to filter by + public List? FindingSeverities { get; set; } + + /// License risk categories to filter by + public List? RiskCategories { get; set; } +} diff --git a/Codacy.Api/Models/SearchSbomDependenciesResponse.cs b/Codacy.Api/Models/SearchSbomDependenciesResponse.cs new file mode 100644 index 0000000..e3ced19 --- /dev/null +++ b/Codacy.Api/Models/SearchSbomDependenciesResponse.cs @@ -0,0 +1,16 @@ +namespace Codacy.Api.Models; + +/// +/// Response body for searching dependencies +/// +public class SearchSbomDependenciesResponse +{ + /// Pagination info + public required PaginationInfo Pagination { get; set; } + + /// The matching dependencies + public required List Data { get; set; } + + /// Overview of the search + public required SbomDependenciesOverview Overview { get; set; } +} diff --git a/Codacy.Api/Models/SearchSbomRepositoriesBody.cs b/Codacy.Api/Models/SearchSbomRepositoriesBody.cs new file mode 100644 index 0000000..1594d98 --- /dev/null +++ b/Codacy.Api/Models/SearchSbomRepositoriesBody.cs @@ -0,0 +1,8 @@ +namespace Codacy.Api.Models; + +/// +/// Request body for searching dependencies by repository. The spec defines no properties, so an empty instance searches unfiltered +/// +public class SearchSbomRepositoriesBody +{ +} diff --git a/Codacy.Api/Models/SearchSbomRepositoriesResponse.cs b/Codacy.Api/Models/SearchSbomRepositoriesResponse.cs new file mode 100644 index 0000000..cdf5deb --- /dev/null +++ b/Codacy.Api/Models/SearchSbomRepositoriesResponse.cs @@ -0,0 +1,16 @@ +namespace Codacy.Api.Models; + +/// +/// Response body for searching repositories with dependency information +/// +public class SearchSbomRepositoriesResponse +{ + /// Pagination info + public required PaginationInfo Pagination { get; set; } + + /// The matching repositories + public required List Data { get; set; } + + /// Overview of the search + public required DependenciesOverviewOfSbomRepositories Overview { get; set; } +} diff --git a/Codacy.Api/Models/Seat.cs b/Codacy.Api/Models/Seat.cs new file mode 100644 index 0000000..26436ab --- /dev/null +++ b/Codacy.Api/Models/Seat.cs @@ -0,0 +1,31 @@ +namespace Codacy.Api.Models; + +/// +/// Enterprise seat +/// +public class Seat +{ + /// Identifiers of the organizations + public required List OrganizationsIds { get; set; } + + /// Emails + public required List Emails { get; set; } + + /// Last analysis + public DateTimeOffset? LastAnalysis { get; set; } + + /// Creation date + public required DateTimeOffset CreatedAt { get; set; } + + /// Last commit identifier + public long? LastCommitId { get; set; } + + /// Provider identifier + public string? ProviderId { get; set; } + + /// Provider login + public string? ProviderLogin { get; set; } + + /// Whether the seat is active + public required bool IsActive { get; set; } +} diff --git a/Codacy.Api/Models/SegmentEntry.cs b/Codacy.Api/Models/SegmentEntry.cs new file mode 100644 index 0000000..ac1d16b --- /dev/null +++ b/Codacy.Api/Models/SegmentEntry.cs @@ -0,0 +1,19 @@ +namespace Codacy.Api.Models; + +/// +/// Segment of an organization +/// +public class SegmentEntry +{ + /// Identifier of the segment + public required long Id { get; set; } + + /// Name of the segment. Specific to the organization. + public required string Name { get; set; } + + /// Value of the segment + public string? Value { get; set; } + + /// Description of the segment + public string? Description { get; set; } +} diff --git a/Codacy.Api/Models/SegmentKeyWithId.cs b/Codacy.Api/Models/SegmentKeyWithId.cs new file mode 100644 index 0000000..09906f0 --- /dev/null +++ b/Codacy.Api/Models/SegmentKeyWithId.cs @@ -0,0 +1,13 @@ +namespace Codacy.Api.Models; + +/// +/// Segment key and id pair +/// +public class SegmentKeyWithId +{ + /// Segment id + public required long Id { get; set; } + + /// Segment key + public required string Key { get; set; } +} diff --git a/Codacy.Api/Models/SegmentsSyncStatusResponse.cs b/Codacy.Api/Models/SegmentsSyncStatusResponse.cs new file mode 100644 index 0000000..c380dbb --- /dev/null +++ b/Codacy.Api/Models/SegmentsSyncStatusResponse.cs @@ -0,0 +1,13 @@ +namespace Codacy.Api.Models; + +/// +/// Status of the segments synchronization +/// +public class SegmentsSyncStatusResponse +{ + /// Status of the segments synchronization process. Valid values are Syncing, Completed, Error, NotSynced. + public required string Status { get; set; } + + /// Error message, if any + public string? Error { get; set; } +} diff --git a/Codacy.Api/Models/SlackIntegration.cs b/Codacy.Api/Models/SlackIntegration.cs new file mode 100644 index 0000000..98c6d99 --- /dev/null +++ b/Codacy.Api/Models/SlackIntegration.cs @@ -0,0 +1,25 @@ +using System.Text.Json.Serialization; + +namespace Codacy.Api.Models; + +/// +/// Details of a Slack integration +/// +public class SlackIntegration +{ + /// Codacy organization ID + [JsonPropertyName("organization_id")] + public required long OrganizationId { get; set; } + + /// Slack Incoming Webhook URL to post notifications to + [JsonPropertyName("webhook_url")] + public required string WebhookUrl { get; set; } + + /// Creation date + [JsonPropertyName("created_at")] + public required DateTimeOffset CreatedAt { get; set; } + + /// Last update date + [JsonPropertyName("updated_at")] + public required DateTimeOffset UpdatedAt { get; set; } +} diff --git a/Codacy.Api/Models/SlackIntegrationRequest.cs b/Codacy.Api/Models/SlackIntegrationRequest.cs new file mode 100644 index 0000000..c8ab6c7 --- /dev/null +++ b/Codacy.Api/Models/SlackIntegrationRequest.cs @@ -0,0 +1,13 @@ +using System.Text.Json.Serialization; + +namespace Codacy.Api.Models; + +/// +/// The request body to create or update the Slack integration of the organization +/// +public class SlackIntegrationRequest +{ + /// Slack Incoming Webhook URL to post notifications to + [JsonPropertyName("webhook_url")] + public required string WebhookUrl { get; set; } +} diff --git a/Codacy.Api/Models/SlackIntegrationResponse.cs b/Codacy.Api/Models/SlackIntegrationResponse.cs new file mode 100644 index 0000000..c4516b9 --- /dev/null +++ b/Codacy.Api/Models/SlackIntegrationResponse.cs @@ -0,0 +1,10 @@ +namespace Codacy.Api.Models; + +/// +/// A response with a Slack integration +/// +public class SlackIntegrationResponse +{ + /// The Slack integration + public required SlackIntegration Data { get; set; } +} diff --git a/Codacy.Api/Models/SshKeySettingResponse.cs b/Codacy.Api/Models/SshKeySettingResponse.cs new file mode 100644 index 0000000..3ce4345 --- /dev/null +++ b/Codacy.Api/Models/SshKeySettingResponse.cs @@ -0,0 +1,10 @@ +namespace Codacy.Api.Models; + +/// +/// SSH key setting response +/// +public class SshKeySettingResponse +{ + /// Public SSH key + public required string PublicSshKey { get; set; } +} diff --git a/Codacy.Api/Models/StandardParameterConflict.cs b/Codacy.Api/Models/StandardParameterConflict.cs new file mode 100644 index 0000000..73964ad --- /dev/null +++ b/Codacy.Api/Models/StandardParameterConflict.cs @@ -0,0 +1,13 @@ +namespace Codacy.Api.Models; + +/// +/// Coding standard and corresponding pattern parameters that have conflicts +/// +public class StandardParameterConflict +{ + /// Coding standard that has the conflict + public required CodingStandardInfo Standard { get; set; } + + /// Conflicting parameters + public required List Parameters { get; set; } +} diff --git a/Codacy.Api/Models/StandardPatternConflict.cs b/Codacy.Api/Models/StandardPatternConflict.cs new file mode 100644 index 0000000..447e0fb --- /dev/null +++ b/Codacy.Api/Models/StandardPatternConflict.cs @@ -0,0 +1,13 @@ +namespace Codacy.Api.Models; + +/// +/// Identifies conflicts in a pattern +/// +public class StandardPatternConflict +{ + /// The pattern id + public required string PatternId { get; set; } + + /// Conflicts for the pattern + public required List Conflicts { get; set; } +} diff --git a/Codacy.Api/Models/SyncProviderSettingResponse.cs b/Codacy.Api/Models/SyncProviderSettingResponse.cs new file mode 100644 index 0000000..179df25 --- /dev/null +++ b/Codacy.Api/Models/SyncProviderSettingResponse.cs @@ -0,0 +1,13 @@ +namespace Codacy.Api.Models; + +/// +/// Repository name and visibility synchronized with the Git provider +/// +public class SyncProviderSettingResponse +{ + /// Name of the repository + public required string Name { get; set; } + + /// Visibility of the repository + public required Visibility Visibility { get; set; } +} diff --git a/Codacy.Api/Models/TaxEstimation.cs b/Codacy.Api/Models/TaxEstimation.cs new file mode 100644 index 0000000..7a17f32 --- /dev/null +++ b/Codacy.Api/Models/TaxEstimation.cs @@ -0,0 +1,16 @@ +namespace Codacy.Api.Models; + +/// +/// Tax estimation +/// +public class TaxEstimation +{ + /// Tax name + public required string Name { get; set; } + + /// Tax rate + public required double Rate { get; set; } + + /// Tax value in dollars + public required double ValueDollars { get; set; } +} diff --git a/Codacy.Api/Models/TimerangeMetricFilterBody.cs b/Codacy.Api/Models/TimerangeMetricFilterBody.cs new file mode 100644 index 0000000..fb5829e --- /dev/null +++ b/Codacy.Api/Models/TimerangeMetricFilterBody.cs @@ -0,0 +1,22 @@ +namespace Codacy.Api.Models; + +/// +/// Request for metric values over a time range +/// +public class TimerangeMetricFilterBody +{ + /// Metric filter + public required MetricFilter Filter { get; set; } + + /// Grouping options + public required MetricGroupBy GroupBy { get; set; } + + /// Start of the time range + public required DateTimeOffset From { get; set; } + + /// End of the time range + public required DateTimeOffset To { get; set; } + + /// Time granularity; if omitted, the backend chooses a default + public MetricPeriod? Period { get; set; } +} diff --git a/Codacy.Api/Models/TimerangeMetricValuesResponse.cs b/Codacy.Api/Models/TimerangeMetricValuesResponse.cs new file mode 100644 index 0000000..787f594 --- /dev/null +++ b/Codacy.Api/Models/TimerangeMetricValuesResponse.cs @@ -0,0 +1,28 @@ +namespace Codacy.Api.Models; + +/// +/// Response containing metric values over a time range +/// +public class TimerangeMetricValuesResponse +{ + /// Metric values per period + public required List Data { get; set; } +} + +/// +/// Value of a metric for a period +/// +public class TimerangeMetricValue +{ + /// Start date of the period + public required DateTimeOffset Date { get; set; } + + /// Group, when grouping was requested + public MetricGroup? Group { get; set; } + + /// Value + public required double Value { get; set; } + + /// Latest value + public double? LatestValue { get; set; } +} diff --git a/Codacy.Api/Models/Tool.cs b/Codacy.Api/Models/Tool.cs new file mode 100644 index 0000000..710303f --- /dev/null +++ b/Codacy.Api/Models/Tool.cs @@ -0,0 +1,49 @@ +namespace Codacy.Api.Models; + +/// +/// Codacy tool that can flag patterns/issues on projects +/// +public class Tool : ToolReference +{ + /// Original tool version used by the Codacy tool wrapper + public required string Version { get; set; } + + /// Tool unique short name, containing alphanumeric characters only and no spaces + public required string ShortName { get; set; } + + /// Original tool documentation URL + public string? DocumentationUrl { get; set; } + + /// Codacy tool wrapper source code URL + public string? SourceCodeUrl { get; set; } + + /// Tool prefix used to ensure pattern names are unique + public string? Prefix { get; set; } + + /// Tool requires compilation to run + public required bool NeedsCompilation { get; set; } + + /// Tool configuration filenames + public required List ConfigurationFilenames { get; set; } + + /// Tool description + public string? Description { get; set; } + + /// Docker image used to launch the tool + public required string DockerImage { get; set; } + + /// Languages that the tool supports + public required List Languages { get; set; } + + /// True if the tool is supposed to run on the client machine and the results sent to Codacy + public required bool ClientSide { get; set; } + + /// True if the client-side tool runs stand-alone outside of the CLI + public required bool Standalone { get; set; } + + /// True if the tool is enabled by default for new projects + public required bool EnabledByDefault { get; set; } + + /// True if the tool is configurable on the Codacy UI + public required bool Configurable { get; set; } +} diff --git a/Codacy.Api/Models/ToolConfiguredPattern.cs b/Codacy.Api/Models/ToolConfiguredPattern.cs new file mode 100644 index 0000000..25691fc --- /dev/null +++ b/Codacy.Api/Models/ToolConfiguredPattern.cs @@ -0,0 +1,22 @@ +namespace Codacy.Api.Models; + +/// +/// Code pattern configuration for a tool +/// +public class ToolConfiguredPattern +{ + /// Definition of the code pattern + public required Pattern PatternDefinition { get; set; } + + /// True if the code pattern is enabled + public required bool Enabled { get; set; } + + /// Whether the pattern is enabled outside the scope of a coding standard + public required bool IsCustom { get; set; } + + /// Configured parameters of the code pattern + public required List Parameters { get; set; } + + /// Coding standards that enable the pattern + public required List EnabledBy { get; set; } +} diff --git a/Codacy.Api/Models/ToolConfiguredPatternListMeta.cs b/Codacy.Api/Models/ToolConfiguredPatternListMeta.cs new file mode 100644 index 0000000..1ddc4f3 --- /dev/null +++ b/Codacy.Api/Models/ToolConfiguredPatternListMeta.cs @@ -0,0 +1,10 @@ +namespace Codacy.Api.Models; + +/// +/// Metadata for a retrieved pattern list +/// +public class ToolConfiguredPatternListMeta +{ + /// Total number of enabled patterns + public required int TotalEnabled { get; set; } +} diff --git a/Codacy.Api/Models/ToolConfiguredPatternResponse.cs b/Codacy.Api/Models/ToolConfiguredPatternResponse.cs new file mode 100644 index 0000000..6006e4e --- /dev/null +++ b/Codacy.Api/Models/ToolConfiguredPatternResponse.cs @@ -0,0 +1,10 @@ +namespace Codacy.Api.Models; + +/// +/// Response containing a single configured code pattern +/// +public class ToolConfiguredPatternResponse +{ + /// Configured pattern + public required ToolConfiguredPattern Data { get; set; } +} diff --git a/Codacy.Api/Models/ToolConfiguredPatternsListResponse.cs b/Codacy.Api/Models/ToolConfiguredPatternsListResponse.cs new file mode 100644 index 0000000..b279646 --- /dev/null +++ b/Codacy.Api/Models/ToolConfiguredPatternsListResponse.cs @@ -0,0 +1,16 @@ +namespace Codacy.Api.Models; + +/// +/// Paginated list of code patterns configured for a tool +/// +public class ToolConfiguredPatternsListResponse +{ + /// Configured patterns + public required List Data { get; set; } + + /// Pagination info + public PaginationInfo? Pagination { get; set; } + + /// Metadata for the retrieved pattern list + public ToolConfiguredPatternListMeta? Meta { get; set; } +} diff --git a/Codacy.Api/Models/ToolListResponse.cs b/Codacy.Api/Models/ToolListResponse.cs new file mode 100644 index 0000000..4d548a7 --- /dev/null +++ b/Codacy.Api/Models/ToolListResponse.cs @@ -0,0 +1,13 @@ +namespace Codacy.Api.Models; + +/// +/// Paginated list of tools +/// +public class ToolListResponse +{ + /// Tools + public required List Data { get; set; } + + /// Pagination info + public PaginationInfo? Pagination { get; set; } +} diff --git a/Codacy.Api/Models/ToolPatternsOverview.cs b/Codacy.Api/Models/ToolPatternsOverview.cs new file mode 100644 index 0000000..d3311ec --- /dev/null +++ b/Codacy.Api/Models/ToolPatternsOverview.cs @@ -0,0 +1,10 @@ +namespace Codacy.Api.Models; + +/// +/// Overview of the patterns in a tool +/// +public class ToolPatternsOverview +{ + /// Pattern counts + public required ToolPatternsOverviewCounts Counts { get; set; } +} diff --git a/Codacy.Api/Models/ToolPatternsOverviewCounts.cs b/Codacy.Api/Models/ToolPatternsOverviewCounts.cs new file mode 100644 index 0000000..202f337 --- /dev/null +++ b/Codacy.Api/Models/ToolPatternsOverviewCounts.cs @@ -0,0 +1,25 @@ +namespace Codacy.Api.Models; + +/// +/// Counts of the patterns in a tool +/// +public class ToolPatternsOverviewCounts +{ + /// Pattern counts by language + public required List Languages { get; set; } + + /// Pattern counts by category + public required List Categories { get; set; } + + /// Pattern counts by severity + public required List Severities { get; set; } + + /// Pattern counts by tag + public required List Tags { get; set; } + + /// Total number of recommended patterns + public required int TotalRecommended { get; set; } + + /// Total number of enabled patterns + public required int TotalEnabled { get; set; } +} diff --git a/Codacy.Api/Models/ToolPatternsOverviewResponse.cs b/Codacy.Api/Models/ToolPatternsOverviewResponse.cs new file mode 100644 index 0000000..4e6b0e7 --- /dev/null +++ b/Codacy.Api/Models/ToolPatternsOverviewResponse.cs @@ -0,0 +1,10 @@ +namespace Codacy.Api.Models; + +/// +/// Response containing the overview of the patterns in a tool +/// +public class ToolPatternsOverviewResponse +{ + /// Patterns overview + public required ToolPatternsOverview Data { get; set; } +} diff --git a/Codacy.Api/Models/UnlinkRepositoryJiraTicketBody.cs b/Codacy.Api/Models/UnlinkRepositoryJiraTicketBody.cs new file mode 100644 index 0000000..728ee76 --- /dev/null +++ b/Codacy.Api/Models/UnlinkRepositoryJiraTicketBody.cs @@ -0,0 +1,13 @@ +namespace Codacy.Api.Models; + +/// +/// Identifies the element to unlink from a Jira ticket +/// +public class UnlinkRepositoryJiraTicketBody +{ + /// Type of Codacy element + public required ElementType ElementType { get; set; } + + /// Element identifier + public required string ElementId { get; set; } +} diff --git a/Codacy.Api/Models/UpdateGatePolicyBody.cs b/Codacy.Api/Models/UpdateGatePolicyBody.cs new file mode 100644 index 0000000..b70d60c --- /dev/null +++ b/Codacy.Api/Models/UpdateGatePolicyBody.cs @@ -0,0 +1,16 @@ +namespace Codacy.Api.Models; + +/// +/// New values for a gate policy +/// +public class UpdateGatePolicyBody +{ + /// Name of the gate policy + public string? GatePolicyName { get; set; } + + /// True if the gate policy is the default for the organization + public bool? IsDefault { get; set; } + + /// Quality gate settings + public QualityGate? Settings { get; set; } +} diff --git a/Codacy.Api/Models/UpdateToolPatternsBody.cs b/Codacy.Api/Models/UpdateToolPatternsBody.cs new file mode 100644 index 0000000..ed1fc15 --- /dev/null +++ b/Codacy.Api/Models/UpdateToolPatternsBody.cs @@ -0,0 +1,10 @@ +namespace Codacy.Api.Models; + +/// +/// Specifies the update to apply to the code patterns of a tool in a repository +/// +public class UpdateToolPatternsBody +{ + /// True enables the code patterns, and false disables them + public required bool Enabled { get; set; } +} diff --git a/Codacy.Api/Models/WebhookAnalysisCompleted.cs b/Codacy.Api/Models/WebhookAnalysisCompleted.cs new file mode 100644 index 0000000..012e714 --- /dev/null +++ b/Codacy.Api/Models/WebhookAnalysisCompleted.cs @@ -0,0 +1,53 @@ +namespace Codacy.Api.Models; + +/// +/// Payload of a quality.analysis.completed webhook delivery, sent when a branch or pull +/// request analysis finishes. Read one with . +/// +public class WebhookAnalysisCompleted +{ + /// The event name, + public required string Event { get; set; } + + /// The repository that was analyzed + public required WebhookRepository Repository { get; set; } + + /// The organization that owns the repository + public required WebhookOrganization Organization { get; set; } + + /// The branch or pull request that was analyzed + public required WebhookTarget Target { get; set; } + + /// The commit that was analyzed. Use it to deduplicate reanalysis of the same commit. + public required string CommitSha { get; set; } + + /// Outcome of the analysis + public required WebhookAnalysisStatus Status { get; set; } + + /// When the analysis completed. Identical across delivery retries. + public required DateTimeOffset Timestamp { get; set; } +} + +/// Repository named in a webhook delivery +public class WebhookRepository +{ + /// Repository name + public required string Name { get; set; } +} + +/// Organization named in a webhook delivery +public class WebhookOrganization +{ + /// Codacy organization identifier + public required long Id { get; set; } +} + +/// Branch or pull request named in a webhook delivery +public class WebhookTarget +{ + /// Whether this is a branch or a pull request + public required WebhookTargetType Type { get; set; } + + /// The branch name, or the pull request number as a string + public required string Value { get; set; } +} diff --git a/Codacy.Api/Models/WebhookAnalysisStatus.cs b/Codacy.Api/Models/WebhookAnalysisStatus.cs new file mode 100644 index 0000000..c040084 --- /dev/null +++ b/Codacy.Api/Models/WebhookAnalysisStatus.cs @@ -0,0 +1,21 @@ +using System.Text.Json.Serialization; + +namespace Codacy.Api.Models; + +/// +/// Outcome of an analysis reported by a webhook delivery +/// +public enum WebhookAnalysisStatus +{ + /// The analysis succeeded + [JsonStringEnumMemberName("success")] + Success, + + /// The analysis completed only in part + [JsonStringEnumMemberName("partial_success")] + PartialSuccess, + + /// The analysis failed + [JsonStringEnumMemberName("failure")] + Failure +} diff --git a/Codacy.Api/Models/WebhookEndpoint.cs b/Codacy.Api/Models/WebhookEndpoint.cs new file mode 100644 index 0000000..75666d5 --- /dev/null +++ b/Codacy.Api/Models/WebhookEndpoint.cs @@ -0,0 +1,16 @@ +namespace Codacy.Api.Models; + +/// +/// A webhook endpoint configured for an organization +/// +public class WebhookEndpoint +{ + /// Webhook endpoint identifier + public required Guid Id { get; set; } + + /// URL that Codacy POSTs deliveries to + public required string Url { get; set; } + + /// When the endpoint was created + public required DateTimeOffset CreatedAt { get; set; } +} diff --git a/Codacy.Api/Models/WebhookEndpointCreated.cs b/Codacy.Api/Models/WebhookEndpointCreated.cs new file mode 100644 index 0000000..cf77692 --- /dev/null +++ b/Codacy.Api/Models/WebhookEndpointCreated.cs @@ -0,0 +1,11 @@ +namespace Codacy.Api.Models; + +/// +/// A newly created webhook endpoint. This is the only time the signing secret is returned, so +/// store it straight away. +/// +public class WebhookEndpointCreated : WebhookEndpoint +{ + /// Secret used to verify the HMAC-SHA256 signature of each delivery + public required string Secret { get; set; } +} diff --git a/Codacy.Api/Models/WebhookEndpointList.cs b/Codacy.Api/Models/WebhookEndpointList.cs new file mode 100644 index 0000000..29a4c9b --- /dev/null +++ b/Codacy.Api/Models/WebhookEndpointList.cs @@ -0,0 +1,16 @@ +namespace Codacy.Api.Models; + +/// +/// The webhook endpoints configured for an organization. Not paginated. +/// +public class WebhookEndpointList +{ + /// Webhook endpoints + public required List Data { get; set; } + + /// Number of webhook endpoints configured for the organization + public required int Count { get; set; } + + /// Maximum number of webhook endpoints allowed per organization + public required int Limit { get; set; } +} diff --git a/Codacy.Api/Models/WebhookTargetType.cs b/Codacy.Api/Models/WebhookTargetType.cs new file mode 100644 index 0000000..238b822 --- /dev/null +++ b/Codacy.Api/Models/WebhookTargetType.cs @@ -0,0 +1,13 @@ +namespace Codacy.Api.Models; + +/// +/// What a webhook delivery's analysis ran against +/// +public enum WebhookTargetType +{ + /// A branch + Branch, + + /// A pull request + PullRequest +} diff --git a/swagger.yaml b/swagger.yaml index 82df7a0..7fdf848 100644 --- a/swagger.yaml +++ b/swagger.yaml @@ -15,7 +15,7 @@ info: url: https://www.codacy.com version: 3.1.0 servers: - - url: https://app.codacy.com/api/v3 + - url: https://api.codacy.com/api/v3 security: - ApiKeyAuth: [] tags: @@ -38,6 +38,9 @@ tags: - name: coverage - name: security - name: jira + - name: airisk + - name: aiinventory + - name: webhooks paths: /version: get: @@ -64,8 +67,8 @@ paths: get: tags: - analysis - summary: List an organization repositories with analysis information for the authenticated user. - description: List an organization repositories with analysis information for the authenticated user. For Bitbucket you must URL encode the cursor before using it in subsequent API calls, as the pagination comes directly from the Git provider. + summary: List organization repositories with analysis information for the authenticated user + description: For Bitbucket, you must URL encode the cursor before using it in subsequent API calls, as the pagination comes directly from the Git provider. operationId: listOrganizationRepositoriesWithAnalysis parameters: - $ref: '#/components/parameters/providerParam' @@ -99,8 +102,8 @@ paths: post: tags: - analysis - summary: Search organization repositories with analysis information for the authenticated user. - description: For Bitbucket you must URL encode the cursor before using it in subsequent API calls, as the pagination comes directly from the Git provider. + summary: Search organization repositories with analysis information for the authenticated user + description: For Bitbucket, you must URL encode the cursor before using it in subsequent API calls, as the pagination comes directly from the Git provider. operationId: searchOrganizationRepositoriesWithAnalysis parameters: - $ref: '#/components/parameters/providerParam' @@ -163,6 +166,9 @@ paths: $ref: '#/components/responses/UnprocessableEntity' '500': $ref: '#/components/responses/InternalServerError' + security: + - ApiKeyAuth: [] + - ProjectTokenAuth: [] x-jvm-package: analysis /analysis/organizations/{provider}/{remoteOrganizationName}/repositories/{repositoryName}/tools: get: @@ -193,14 +199,15 @@ paths: $ref: '#/components/responses/UnprocessableEntity' '500': $ref: '#/components/responses/InternalServerError' + security: + - ApiKeyAuth: [] + - ProjectTokenAuth: [] x-jvm-package: analysis /analysis/organizations/{provider}/{remoteOrganizationName}/repositories/{repositoryName}/tools/conflicts: get: tags: - analysis summary: Get tools with conflicts in a repository - description: | - Get tools with conflicts in a repository operationId: listRepositoryToolConflicts parameters: - $ref: '#/components/parameters/providerParam' @@ -259,6 +266,9 @@ paths: $ref: '#/components/responses/UnprocessableEntity' '500': $ref: '#/components/responses/InternalServerError' + security: + - ApiKeyAuth: [] + - ProjectTokenAuth: [] x-jvm-package: analysis x-codegen-request-body-name: configureToolBody /analysis/organizations/{provider}/{remoteOrganizationName}/repositories/{repositoryName}/tools/{toolUuid}/patterns: @@ -280,6 +290,7 @@ paths: - $ref: '#/components/parameters/searchParam' - $ref: '#/components/parameters/enabledPatternParam' - $ref: '#/components/parameters/recommendedPatternParam' + - $ref: '#/components/parameters/matchesStackParam' - $ref: '#/components/parameters/patternsSortParam' - $ref: '#/components/parameters/directionParam' - $ref: '#/components/parameters/cursorParam' @@ -303,6 +314,9 @@ paths: $ref: '#/components/responses/UnprocessableEntity' '500': $ref: '#/components/responses/InternalServerError' + security: + - ApiKeyAuth: [] + - ProjectTokenAuth: [] x-jvm-package: analysis patch: tags: @@ -322,6 +336,7 @@ paths: - $ref: '#/components/parameters/tagsParam' - $ref: '#/components/parameters/searchParam' - $ref: '#/components/parameters/recommendedPatternParam' + - $ref: '#/components/parameters/matchesStackParam' requestBody: content: application/json: @@ -346,6 +361,9 @@ paths: $ref: '#/components/responses/UnprocessableEntity' '500': $ref: '#/components/responses/InternalServerError' + security: + - ApiKeyAuth: [] + - ProjectTokenAuth: [] x-jvm-package: analysis x-codegen-request-body-name: updatePatternsBody /analysis/organizations/{provider}/{remoteOrganizationName}/repositories/{repositoryName}/tools/{toolUuid}/patterns/{patternId}: @@ -400,6 +418,7 @@ paths: - $ref: '#/components/parameters/searchParam' - $ref: '#/components/parameters/enabledPatternParam' - $ref: '#/components/parameters/recommendedPatternParam' + - $ref: '#/components/parameters/matchesStackParam' responses: '200': description: Successful operation @@ -419,6 +438,9 @@ paths: $ref: '#/components/responses/UnprocessableEntity' '500': $ref: '#/components/responses/InternalServerError' + security: + - ApiKeyAuth: [] + - ProjectTokenAuth: [] x-jvm-package: analysis /analysis/organizations/{provider}/{remoteOrganizationName}/repositories/{repositoryName}/tools/{toolUuid}/conflicts: get: @@ -483,13 +505,137 @@ paths: '500': $ref: '#/components/responses/InternalServerError' x-jvm-package: analysis + /analysis/organizations/{provider}/{remoteOrganizationName}/repositories/{repositoryName}/recover: + post: + tags: + - analysis + summary: Recover a stuck repository + description: | + Triggers a recovery action when the repository is stuck on its first analysis. + The exact action taken depends on the stuck state. + Returns `422 Unprocessable Entity` when the repository is not stuck. + operationId: recoverRepository + parameters: + - $ref: '#/components/parameters/providerParam' + - $ref: '#/components/parameters/remoteOrganizationNameParam' + - $ref: '#/components/parameters/repositoryNameParam' + - $ref: '#/components/parameters/branchNameParam' + responses: + '204': + description: Successful operation + content: {} + '400': + $ref: '#/components/responses/BadRequest' + '401': + $ref: '#/components/responses/Unauthorized' + '403': + $ref: '#/components/responses/Forbidden' + '404': + $ref: '#/components/responses/NotFound' + '422': + $ref: '#/components/responses/UnprocessableEntity' + '500': + $ref: '#/components/responses/InternalServerError' + x-jvm-package: analysis + /analysis/organizations/{provider}/{remoteOrganizationName}/repositories/{repositoryName}/autoconfig: + post: + tags: + - analysis + summary: Add repository autoconfiguration run + description: | + **[Experimental]** Autoconfig enqueuing endpoint + operationId: addAutoconfig + parameters: + - $ref: '#/components/parameters/providerParam' + - $ref: '#/components/parameters/remoteOrganizationNameParam' + - $ref: '#/components/parameters/repositoryNameParam' + responses: + '202': + description: Autoconfig run accepted + content: + application/json: + schema: + $ref: '#/components/schemas/AddAutoconfigResponse' + '400': + $ref: '#/components/responses/BadRequest' + '401': + $ref: '#/components/responses/Unauthorized' + '403': + $ref: '#/components/responses/Forbidden' + '404': + $ref: '#/components/responses/NotFound' + '422': + $ref: '#/components/responses/UnprocessableEntity' + '429': + $ref: '#/components/responses/TooManyRequests' + '500': + $ref: '#/components/responses/InternalServerError' + x-jvm-package: analysis + /analysis/organizations/{provider}/{remoteOrganizationName}/repositories/{repositoryName}/autoconfig/runs: + get: + tags: + - analysis + summary: Get latest autoconfig run summary + operationId: getLatestAutoconfigRunSummary + parameters: + - $ref: '#/components/parameters/providerParam' + - $ref: '#/components/parameters/remoteOrganizationNameParam' + - $ref: '#/components/parameters/repositoryNameParam' + responses: + '200': + description: Successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/AutoconfigRunSummaryResponse' + '400': + $ref: '#/components/responses/BadRequest' + '401': + $ref: '#/components/responses/Unauthorized' + '403': + $ref: '#/components/responses/Forbidden' + '404': + $ref: '#/components/responses/NotFound' + '500': + $ref: '#/components/responses/InternalServerError' + x-jvm-package: analysis + /analysis/organizations/{provider}/{remoteOrganizationName}/repositories/{repositoryName}/autoconfig/status: + get: + tags: + - analysis + summary: Get autoconfig run status + description: | + **[Experimental]** Fetch latest autoconfig run state managed (can be `Requested`, `Running`, `Done` or `Failed`) + operationId: getAutoconfigStatus + parameters: + - $ref: '#/components/parameters/providerParam' + - $ref: '#/components/parameters/remoteOrganizationNameParam' + - $ref: '#/components/parameters/repositoryNameParam' + responses: + '200': + description: Successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/AutoconfigStatusResponse' + '400': + $ref: '#/components/responses/BadRequest' + '401': + $ref: '#/components/responses/Unauthorized' + '403': + $ref: '#/components/responses/Forbidden' + '404': + $ref: '#/components/responses/NotFound' + '500': + $ref: '#/components/responses/InternalServerError' + x-jvm-package: analysis /analysis/organizations/{provider}/{remoteOrganizationName}/repositories/{repositoryName}/pull-requests: get: tags: - analysis - summary: List pull requests from a repository that the user as access to + summary: List pull requests from a repository that the user has access to description: | - You can search this endpoint for either `last-updated` (default), `impact` or `merged` + You can search this endpoint for either `last-updated` (default), `merged` **Note:** When applied to public repositories, this operation does not require authentication. operationId: listRepositoryPullRequests @@ -500,6 +646,8 @@ paths: - $ref: '#/components/parameters/limitParam' - $ref: '#/components/parameters/cursorParam' - $ref: '#/components/parameters/searchParam' + - $ref: '#/components/parameters/textQueryParam' + - $ref: '#/components/parameters/targetBranchParam' - name: includeNotAnalyzed in: query description: If true, also return pull requests that weren't analyzed @@ -643,6 +791,37 @@ paths: '500': $ref: '#/components/responses/InternalServerError' x-jvm-package: coverage + /coverage/organizations/{provider}/{remoteOrganizationName}/repositories/{repositoryName}/commits/{commitUuid}/reanalyze: + post: + tags: + - coverage + summary: Reanalyze the coverage for a commit + description: | + Triggers the reanalysis of the latest coverage report uploaded for the commit. + Has no effect if the commit does not have any coverage report. + operationId: reanalyzeCommitCoverage + parameters: + - $ref: '#/components/parameters/providerParam' + - $ref: '#/components/parameters/remoteOrganizationNameParam' + - $ref: '#/components/parameters/repositoryNameParam' + - $ref: '#/components/parameters/commitUuid' + responses: + '204': + description: Successful operation + content: {} + '400': + $ref: '#/components/responses/BadRequest' + '401': + $ref: '#/components/responses/Unauthorized' + '403': + $ref: '#/components/responses/Forbidden' + '404': + $ref: '#/components/responses/NotFound' + '422': + $ref: '#/components/responses/UnprocessableEntity' + '500': + $ref: '#/components/responses/InternalServerError' + x-jvm-package: coverage /analysis/organizations/{provider}/{remoteOrganizationName}/repositories/{repositoryName}/pull-requests/{pullRequestNumber}/commits: get: tags: @@ -704,6 +883,36 @@ paths: '500': $ref: '#/components/responses/InternalServerError' x-jvm-package: analysis + /analysis/organizations/{provider}/{remoteOrganizationName}/repositories/{repositoryName}/pull-requests/{pullRequestNumber}/ai-reviewer/trigger: + post: + tags: + - analysis + summary: Triggers an AI review for a pull request + operationId: triggerPullRequestAiReview + parameters: + - $ref: '#/components/parameters/providerParam' + - $ref: '#/components/parameters/remoteOrganizationNameParam' + - $ref: '#/components/parameters/repositoryNameParam' + - $ref: '#/components/parameters/pullRequestNumberParam' + responses: + '204': + description: Successful operation + content: {} + '400': + $ref: '#/components/responses/BadRequest' + '401': + $ref: '#/components/responses/Unauthorized' + '403': + $ref: '#/components/responses/Forbidden' + '404': + $ref: '#/components/responses/NotFound' + '409': + $ref: '#/components/responses/Conflict' + '422': + $ref: '#/components/responses/UnprocessableEntity' + '500': + $ref: '#/components/responses/InternalServerError' + x-jvm-package: analysis /analysis/organizations/{provider}/{remoteOrganizationName}/repositories/{repositoryName}/pull-requests/{pullRequestNumber}/coverage/status: get: tags: @@ -739,7 +948,7 @@ paths: tags: - analysis summary: List issues found in a pull request - description: Returns a list of issues found in a pull request. We can request either new or fixed issues. + description: Use the status parameter to filter by new or fixed issues operationId: listPullRequestIssues parameters: - $ref: '#/components/parameters/providerParam' @@ -773,7 +982,7 @@ paths: tags: - analysis summary: List duplicate code blocks found in a pull request - description: Returns a list of new or removed duplicate code blocks found in a pull request. + description: Use the status parameter to filter by new or removed duplicates operationId: listPullRequestClones parameters: - $ref: '#/components/parameters/providerParam' @@ -807,7 +1016,7 @@ paths: tags: - analysis summary: List duplicate code blocks found in a commit - description: Returns a list of new or removed duplicate code blocks found in a commit. + description: Use the status parameter to filter by new or removed duplicates operationId: listCommitClones parameters: - $ref: '#/components/parameters/providerParam' @@ -849,7 +1058,6 @@ paths: tags: - analysis summary: Get analysis logs for a pull request - description: Returns the analysis logs for the specified pull request. operationId: listPullRequestLogs parameters: - $ref: '#/components/parameters/providerParam' @@ -879,7 +1087,6 @@ paths: tags: - analysis summary: Get analysis logs for a commit - description: Returns the analysis logs for the specified commit. operationId: listCommitLogs parameters: - $ref: '#/components/parameters/providerParam' @@ -908,9 +1115,12 @@ paths: get: tags: - analysis - summary: '[Deprecated: use [getQualitySettingsForRepository](#getqualitysettingsforrepository) instead] Get quality settings for the specific repository' + summary: Get quality settings for the specific repository description: | + **Deprecated:** Use [getQualitySettingsForRepository](#getqualitysettingsforrepository) instead. + **Note:** When applied to public repositories, this operation does not require authentication. + deprecated: true operationId: getRepositoryQualitySettings parameters: - $ref: '#/components/parameters/providerParam' @@ -933,7 +1143,6 @@ paths: $ref: '#/components/responses/UnprocessableEntity' '500': $ref: '#/components/responses/InternalServerError' - deprecated: true x-jvm-package: analysis /analysis/organizations/{provider}/{remoteOrganizationName}/repositories/{repositoryName}/commits/{commitUuid}/files: get: @@ -949,7 +1158,8 @@ paths: - $ref: '#/components/parameters/branchNameParam' - name: filter in: query - description: Optional field to filter the results. The possible values are empty (default, return files changed in the commit or with coverage changes) or `withCoverageChanges` (return files with coverage changes). + description: | + Optional field to filter the results. The possible values are empty (default, return files changed in the commit or with coverage changes) or `withCoverageChanges` (return files with coverage changes) schema: type: string enum: @@ -961,7 +1171,8 @@ paths: - $ref: '#/components/parameters/filesSearchFilter' - name: sortColumn in: query - description: Field used to sort the results. The possible values are `deltaCoverage` (to sort by the coverage variation value of the files) , `totalCoverage` (to sort by the total coverage value of the files) or `filename` (default - to sort by the name of the files). + description: | + Field used to sort the results. The possible values are `deltaCoverage` (to sort by the coverage variation value of the files), `totalCoverage` (to sort by the total coverage value of the files) or `filename` (default - to sort by the name of the files) schema: type: string default: filename @@ -1011,7 +1222,8 @@ paths: - $ref: '#/components/parameters/limitParam' - name: sortColumn in: query - description: Field used to sort the results. The possible values are `deltaCoverage` (to sort by the coverage variation value of the files) , `totalCoverage` (to sort by the total coverage value of the files) or `filename` (default - to sort by the name of the files). + description: | + Field used to sort the results. The possible values are `deltaCoverage` (to sort by the coverage variation value of the files), `totalCoverage` (to sort by the total coverage value of the files) or `filename` (default - to sort by the name of the files) schema: type: string default: filename @@ -1079,7 +1291,7 @@ paths: tags: - repository - configuration - summary: unfollow a repository + summary: Unfollow a repository operationId: unfollowRepository parameters: - $ref: '#/components/parameters/providerParam' @@ -1231,7 +1443,7 @@ paths: - repository - configuration summary: Get the public SSH key for the repository - description: Returns the most recently generated public SSH key, which can be either a user or repository SSH key. + description: The returned key is the most recently generated and can be either a user or repository SSH key. operationId: getRepositoryPublicSshKey parameters: - $ref: '#/components/parameters/providerParam' @@ -1321,7 +1533,7 @@ paths: tags: - repository - configuration - summary: Updates the status of the repository setting **Run analysis on your build server** + summary: Update the status of the repository setting **Run analysis on your build server** operationId: updateBuildServerAnalysisSetting parameters: - $ref: '#/components/parameters/providerParam' @@ -1393,6 +1605,9 @@ paths: $ref: '#/components/responses/UnprocessableEntity' '500': $ref: '#/components/responses/InternalServerError' + security: + - ApiKeyAuth: [] + - ProjectTokenAuth: [] x-jvm-package: fileExtension patch: tags: @@ -1510,7 +1725,7 @@ paths: tags: - repository - configuration - summary: Get quality settings for the commits of a repository. + summary: Get quality settings for the commits of a repository description: | `diffCoverageThreshold` is never returned because this threshold isn't currently supported for commits. operationId: getCommitQualitySettings @@ -1728,8 +1943,8 @@ paths: get: tags: - analysis - summary: List an organization pull requests from repositories that the user as access to - description: You can search this endpoint for either `last-updated` (default), `impact` or `merged` + summary: List organization pull requests from repositories that the user has access to + description: You can sort by `last-updated` (default), `merged` operationId: listOrganizationPullRequests parameters: - $ref: '#/components/parameters/providerParam' @@ -1759,7 +1974,7 @@ paths: get: tags: - analysis - summary: Lists commit analysis statistics in the last `n` days that have analysis data + summary: List commit analysis statistics for the last n days that have analysis data description: | Returns the last `n` days with available data. This means that the returned days may not match the last `n` calendar days. @@ -1793,7 +2008,7 @@ paths: get: tags: - analysis - summary: Lists analysis category overviews for a repository that the user as access to + summary: List analysis category overviews for a repository that the user has access to description: | **Note:** When applied to public repositories, this operation does not require authentication. operationId: listCategoryOverviews @@ -1854,13 +2069,16 @@ paths: $ref: '#/components/responses/UnprocessableEntity' '500': $ref: '#/components/responses/InternalServerError' + security: + - ApiKeyAuth: [] + - ProjectTokenAuth: [] x-jvm-package: analysis /analysis/organizations/{provider}/{remoteOrganizationName}/repositories/{repositoryName}/issues/bulk-ignore: post: tags: - analysis summary: Bulk ignore issues in a repository - description: Receives a list of issue ids and ignores them in the specified repository. Limited to 50 issues at once + description: Receives a list of issue ids and ignores them in the specified repository. Limited to 100 issues at once operationId: bulkIgnoreIssues parameters: - $ref: '#/components/parameters/providerParam' @@ -1920,12 +2138,15 @@ paths: $ref: '#/components/responses/UnprocessableEntity' '500': $ref: '#/components/responses/InternalServerError' + security: + - ApiKeyAuth: [] + - ProjectTokenAuth: [] x-jvm-package: analysis /analysis/organizations/{provider}/{remoteOrganizationName}/repositories/{repositoryName}/issues/{issueId}: get: tags: - analysis - summary: Returns information about an issue that Codacy found in a repository and that is still open. + summary: Get information about an open issue in a repository operationId: getIssue parameters: - $ref: '#/components/parameters/providerParam' @@ -2016,7 +2237,8 @@ paths: tags: - analysis summary: List ignored issues in a repository - description: Returns information about the issues that Codacy found in a repository and were ignored on the Codacy UI. Use [SearchRepositoryIssuesBody](#tocssearchrepositoryissuesbody) to filter the returned ignored issues. + description: | + Ignored issues are issues that Codacy found but were marked as ignored on the Codacy UI. Use [SearchRepositoryIssuesBody](#tocssearchrepositoryissuesbody) to filter results. operationId: searchRepositoryIgnoredIssues parameters: - $ref: '#/components/parameters/providerParam' @@ -2025,7 +2247,7 @@ paths: - $ref: '#/components/parameters/cursorParam' - $ref: '#/components/parameters/limitParam' requestBody: - $ref: '#/components/requestBodies/searchIssuesFilter' + $ref: '#/components/requestBodies/searchIgnoredIssuesFilter' responses: '200': description: List of ignored issues in the repository @@ -2074,6 +2296,9 @@ paths: $ref: '#/components/responses/UnprocessableEntity' '500': $ref: '#/components/responses/InternalServerError' + security: + - ApiKeyAuth: [] + - ProjectTokenAuth: [] x-jvm-package: analysis /analysis/organizations/{provider}/{remoteOrganizationName}/repositories/{repositoryName}/commits/{commitUuid}: get: @@ -2122,7 +2347,7 @@ paths: - $ref: '#/components/parameters/commitUuid' responses: '200': - description: Succesful operation + description: Successful operation content: application/json: schema: @@ -2195,7 +2420,6 @@ paths: tags: - account summary: Get the authenticated user - description: Get the authenticated user operationId: getUser responses: '200': @@ -2347,7 +2571,6 @@ paths: tags: - account summary: List emails for the authenticated user - description: List emails for the authenticated user operationId: listUserEmails responses: '200': @@ -2714,6 +2937,7 @@ paths: - $ref: '#/components/parameters/paymentPlanCodeParam' - name: promoCode in: query + description: Optional promotional code to apply to the billing estimation. required: false schema: type: string @@ -2739,8 +2963,8 @@ paths: post: tags: - organization - summary: Changes the plan of an organization to the given plan - description: Changes the plan of an organization to the given plan, codes are available on the plans API + summary: Change the plan of an organization + description: Available plan codes can be retrieved using [listPaymentPlans](#listpaymentplans) operationId: changeOrganizationPlan parameters: - $ref: '#/components/parameters/providerParam' @@ -2944,7 +3168,7 @@ paths: get: tags: - repository - summary: Creates a [post-commit hook](https://docs.codacy.com/repositories-configure/integrations/post-commit-hooks/) for a repository + summary: Create a [post-commit hook](https://docs.codacy.com/repositories-configure/integrations/post-commit-hooks/) for a repository operationId: createPostCommitHook parameters: - $ref: '#/components/parameters/providerParam' @@ -3009,13 +3233,10 @@ paths: get: tags: - organization - summary: List an organization repositories for the authenticated user. + summary: List organization repositories for the authenticated user description: | - List an organization's repositories for the authenticated user. For Bitbucket you must URL encode the cursor before using it in subsequent API calls, as the pagination comes directly from the Git provider. This endpoint may return more results than those specified in the limit parameter. - If this endpoint doesn't return your repositories after you've made recent changes to the permissions on your Git provider, - use the endpoint [cleanCache](#cleanCache) to force refreshing the list of repositories for the authenticated user. **Note:** When applied to public repositories, this operation does not require authentication. operationId: listOrganizationRepositories @@ -3027,6 +3248,7 @@ paths: - $ref: '#/components/parameters/searchParam' - $ref: '#/components/parameters/repositoryFilterParam' - $ref: '#/components/parameters/languagesFilterParam' + - $ref: '#/components/parameters/stackTagsFilterParam' - $ref: '#/components/parameters/segmentsParam' responses: '200': @@ -3052,7 +3274,7 @@ paths: get: tags: - organization - summary: Retrieves the onboarding progress of the organization + summary: Retrieve the onboarding progress of an organization operationId: retrieveOrganizationOnboardingProgress parameters: - $ref: '#/components/parameters/providerParam' @@ -3173,7 +3395,8 @@ paths: tags: - organization summary: Configure what your organization members can do across the Codacy platform - description: Define the lowest permission level that can configure patterns, configure which file extensions and branches are analyzed, and ignore issues and files + description: | + Define the lowest permission level that can configure patterns, configure which file extensions and branches are analyzed, and ignore issues and files operationId: patchOrganizationSettings parameters: - $ref: '#/components/parameters/providerParam' @@ -3229,8 +3452,12 @@ paths: $ref: '#/components/responses/BadRequest' '401': $ref: '#/components/responses/Unauthorized' + '403': + $ref: '#/components/responses/Forbidden' '404': $ref: '#/components/responses/NotFound' + '409': + $ref: '#/components/responses/Conflict' '422': $ref: '#/components/responses/UnprocessableEntity' '500': @@ -3241,7 +3468,7 @@ paths: get: tags: - app - summary: Returns the status of the permissions required by the Codacy Git provider App installed on the organization + summary: Get the status of Codacy Git provider app permissions for an organization operationId: gitProviderAppPermissions parameters: - $ref: '#/components/parameters/providerParam' @@ -3328,6 +3555,9 @@ paths: $ref: '#/components/responses/UnprocessableEntity' '500': $ref: '#/components/responses/InternalServerError' + security: + - ApiKeyAuth: [] + - ProjectTokenAuth: [] x-jvm-package: repository x-codegen-request-body-name: commitUuid /organizations/{provider}/{remoteOrganizationName}/repositories/{repositoryName}: @@ -3361,6 +3591,9 @@ paths: $ref: '#/components/responses/UnprocessableEntity' '500': $ref: '#/components/responses/InternalServerError' + security: + - ApiKeyAuth: [] + - ProjectTokenAuth: [] x-jvm-package: repository delete: tags: @@ -3708,8 +3941,9 @@ paths: delete: tags: - organization - summary: Decline Requests to join an organization - description: Endpoint to decline request to join an organization by provider, name and user emails to be rejected + summary: Decline requests to join an organization + description: | + Decline requests to join an organization by specifying the provider, organization name, and the user emails to be rejected. operationId: declineRequestsToJoinOrganization parameters: - $ref: '#/components/parameters/providerParam' @@ -3736,7 +3970,7 @@ paths: tags: - organization summary: Delete a request to join an organization - description: Endpoint to delete a request to join an organization by provider, name and user id + description: Delete a request to join an organization by provider, name, and user ID operationId: deleteOrganizationJoinRequest parameters: - $ref: '#/components/parameters/providerParam' @@ -3757,31 +3991,6 @@ paths: '500': $ref: '#/components/responses/InternalServerError' x-jvm-package: organization - /organizations/{provider}/{remoteOrganizationName}/cache/clean: - post: - tags: - - organization - summary: Clean organization cache for the authenticated user - description: Clean cached information regarding the authenticated user on the specified organization, such as the list of repositories in the organization. - operationId: cleanCache - parameters: - - $ref: '#/components/parameters/providerParam' - - $ref: '#/components/parameters/remoteOrganizationNameParam' - responses: - '204': - description: Successful operation - content: {} - '400': - $ref: '#/components/responses/BadRequest' - '401': - $ref: '#/components/responses/Unauthorized' - '404': - $ref: '#/components/responses/NotFound' - '422': - $ref: '#/components/responses/UnprocessableEntity' - '500': - $ref: '#/components/responses/InternalServerError' - x-jvm-package: organization /repositories: post: tags: @@ -3792,7 +4001,7 @@ paths: parameters: - name: caller in: header - description: Caller + description: Optional identifier for the calling application or service. schema: type: string requestBody: @@ -3890,30 +4099,6 @@ paths: '500': $ref: '#/components/responses/InternalServerError' x-jvm-package: enterprise - /enterprises/{provider}/cache/clean: - post: - tags: - - enterprise - summary: Clean enterprise cache for the authenticated user - description: Clean cached information regarding the authenticated user on the specified enterprise, such as the list of repositories in the enterprise. - operationId: cleanEnterpriseCache - parameters: - - $ref: '#/components/parameters/providerParam' - responses: - '204': - description: Successful operation - content: {} - '400': - $ref: '#/components/responses/BadRequest' - '401': - $ref: '#/components/responses/Unauthorized' - '404': - $ref: '#/components/responses/NotFound' - '422': - $ref: '#/components/responses/UnprocessableEntity' - '500': - $ref: '#/components/responses/InternalServerError' - x-jvm-package: enterprise /user/enterprise/integrations: get: tags: @@ -4041,6 +4226,27 @@ paths: '500': $ref: '#/components/responses/InternalServerError' x-jvm-package: account + /user/billing/sync: + post: + tags: + - organization + summary: Sync the information about user's organization billing + operationId: syncUserMarketplaceBilling + responses: + '204': + description: Successful operation + content: {} + '400': + $ref: '#/components/responses/BadRequest' + '401': + $ref: '#/components/responses/Unauthorized' + '404': + $ref: '#/components/responses/NotFound' + '422': + $ref: '#/components/responses/UnprocessableEntity' + '500': + $ref: '#/components/responses/InternalServerError' + x-jvm-package: organization /billing/{provider}/{remoteOrganizationName}/subscription: delete: tags: @@ -4160,39 +4366,162 @@ paths: $ref: '#/components/responses/InternalServerError' security: [] x-jvm-package: health - /admin/license: - post: + /admin: + get: tags: - admin - summary: (Codacy admins only) Generates a license for self-hosted instances of Codacy - operationId: generateLicense - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/License' - required: true + x-jvm-package: admin + summary: (Codacy admins only) Search for an entity like Organization or Repository, supports ids and names + operationId: adminSearch + parameters: + - $ref: '#/components/parameters/searchParam' responses: '200': description: Successful operation content: application/json: schema: - $ref: '#/components/schemas/LicenseResponse' - '400': - $ref: '#/components/responses/BadRequest' + $ref: '#/components/schemas/AdminEntityGroupResponse' '401': $ref: '#/components/responses/Unauthorized' '403': $ref: '#/components/responses/Forbidden' - '422': - $ref: '#/components/responses/UnprocessableEntity' '500': $ref: '#/components/responses/InternalServerError' - x-jvm-package: admin.license - x-codegen-request-body-name: LicenseBody - /admin/dormantAccounts: - delete: + /admin/{adminEntityGroupSlug}/{adminEntityIdentifier}: + get: + tags: + - admin + x-jvm-package: admin + summary: (Codacy admins only) Returns the requested admin entity + operationId: getAdminEntity + parameters: + - $ref: '#/components/parameters/adminEntityGroupSlugParam' + - $ref: '#/components/parameters/adminEntityIdentifierParam' + responses: + '200': + description: Successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/AdminEntityResponse' + '400': + $ref: '#/components/responses/BadRequest' + '401': + $ref: '#/components/responses/Unauthorized' + '403': + $ref: '#/components/responses/Forbidden' + '404': + $ref: '#/components/responses/NotFound' + '500': + $ref: '#/components/responses/InternalServerError' + '501': + $ref: '#/components/responses/NotImplemented' + /admin/{adminEntityGroupSlug}/{adminEntityIdentifier}/{adminResourceSlug}: + get: + tags: + - admin + x-jvm-package: admin + summary: (Codacy admins only) Returns the requested resources of a given admin entity + operationId: listAdminEntityResources + parameters: + - $ref: '#/components/parameters/adminEntityGroupSlugParam' + - $ref: '#/components/parameters/adminEntityIdentifierParam' + - $ref: '#/components/parameters/adminResourceSlugParam' + - $ref: '#/components/parameters/cursorParam' + - $ref: '#/components/parameters/limitParam' + responses: + '200': + description: Successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/AdminEntityResourcesResponse' + '400': + $ref: '#/components/responses/BadRequest' + '401': + $ref: '#/components/responses/Unauthorized' + '403': + $ref: '#/components/responses/Forbidden' + '404': + $ref: '#/components/responses/NotFound' + '409': + $ref: '#/components/responses/Conflict' + '500': + $ref: '#/components/responses/InternalServerError' + '501': + $ref: '#/components/responses/NotImplemented' + /admin/{adminEntityGroupSlug}/{adminEntityIdentifier}/actions/{adminActionSlug}: + post: + tags: + - admin + x-jvm-package: admin + summary: (Codacy admins only) Executes an action on a given admin entity + operationId: executeAdminAction + parameters: + - $ref: '#/components/parameters/adminEntityGroupSlugParam' + - $ref: '#/components/parameters/adminEntityIdentifierParam' + - $ref: '#/components/parameters/adminActionSlugParam' + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/AdminEntityActionPayload' + responses: + '200': + description: Action executed successfully + content: + application/json: + schema: + $ref: '#/components/schemas/AdminEntityActionResponse' + '400': + $ref: '#/components/responses/BadRequest' + '401': + $ref: '#/components/responses/Unauthorized' + '403': + $ref: '#/components/responses/Forbidden' + '404': + $ref: '#/components/responses/NotFound' + '409': + $ref: '#/components/responses/Conflict' + '500': + $ref: '#/components/responses/InternalServerError' + '501': + $ref: '#/components/responses/NotImplemented' + /admin/license: + post: + tags: + - admin + summary: (Codacy admins only) Generates a license for self-hosted instances of Codacy + operationId: generateLicense + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/License' + required: true + responses: + '200': + description: Successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/LicenseResponse' + '400': + $ref: '#/components/responses/BadRequest' + '401': + $ref: '#/components/responses/Unauthorized' + '403': + $ref: '#/components/responses/Forbidden' + '422': + $ref: '#/components/responses/UnprocessableEntity' + '500': + $ref: '#/components/responses/InternalServerError' + x-jvm-package: admin.license + x-codegen-request-body-name: LicenseBody + /admin/dormantAccounts: + delete: tags: - admin summary: (Codacy admins only) Delete Codacy users based on a CSV file exported by GitHub Enterprise @@ -4227,7 +4556,7 @@ paths: post: tags: - admin - summary: Internal, used by Codacy admins to upload pen test reports for a given organization + summary: Upload pen test reports for an organization (internal, Codacy admins only) operationId: uploadPenTestReport requestBody: content: @@ -4241,15 +4570,15 @@ paths: properties: csvdata: type: string - description: The pen test report in CSV format. + description: The pen test report in CSV format format: binary provider: type: string - description: Git provider hosting the organization's repositories. + description: Git provider hosting the organization's repositories x-ms-parameter-location: method organizationName: type: string - description: The name of the organization to which the results belong. + description: The name of the organization to which the results belong required: true responses: '202': @@ -4272,8 +4601,7 @@ paths: get: tags: - languages - summary: Retrieves the list of languages of available tools - description: Lists the languages of the available tools in Codacy + summary: Retrieve the list of languages supported by available tools operationId: listLanguagesWithTools responses: '200': @@ -4294,8 +4622,7 @@ paths: get: tags: - tools - summary: Retrieves the list of tools - description: Lists the available tools in Codacy + summary: Retrieve the list of tools operationId: listTools parameters: - $ref: '#/components/parameters/cursorParam' @@ -4320,7 +4647,6 @@ paths: tags: - tools summary: Retrieve the list of tool patterns - description: Lists the available patterns for the given tool operationId: listPatterns parameters: - $ref: '#/components/parameters/toolUuidParam' @@ -4328,7 +4654,7 @@ paths: - $ref: '#/components/parameters/limitParam' - name: enabled in: query - description: Indicates whether the entity is enabled + description: Filter by enabled status. Set to `true` to return only enabled patterns, or `false` to return only disabled patterns. required: false schema: type: boolean @@ -4414,8 +4740,7 @@ paths: get: tags: - tools - summary: Retrieves the list of tools - description: Lists the available duplication tools in Codacy + summary: Retrieve the list of duplication tools operationId: listDuplicationTools responses: '200': @@ -4434,8 +4759,7 @@ paths: get: tags: - tools - summary: Retrieves the list of tools - description: Lists the available metrics tools in Codacy + summary: Retrieve the list of metrics tools operationId: listMetricsTools responses: '200': @@ -4454,14 +4778,20 @@ paths: post: tags: - metrics - summary: Organization to start collecting metrics + summary: Start collecting metrics for an organization description: | Start data collection for missing metrics. - Organization needs to support metrics. + The organization must have metrics support enabled. operationId: initiateMetricsForOrganization parameters: - $ref: '#/components/parameters/providerParam' - $ref: '#/components/parameters/remoteOrganizationNameParam' + requestBody: + required: false + content: + application/json: + schema: + $ref: '#/components/schemas/MetricsFilter' responses: '204': description: Successful operation @@ -4483,9 +4813,9 @@ paths: get: tags: - metrics - summary: Returns metrics that are ready in Organization + summary: Retrieve metrics that are ready for an organization description: | - Returns metrics that are ready in Organization. + Retrieve the list of metrics that have completed data collection for an organization. operationId: readyMetricsForOrganization parameters: - $ref: '#/components/parameters/providerParam' @@ -4512,9 +4842,9 @@ paths: post: tags: - metrics - summary: Get latest value metric + summary: Retrieve the latest value of a metric description: | - Retrieves the latest value for an aggregating metric, e.g. open issues. + Retrieve the latest value for an aggregating metric (e.g., open issues). **Note:** It does not work for accumulating metrics, such as fixed issues operationId: retrieveLatestMetricValue @@ -4551,10 +4881,10 @@ paths: post: tags: - metrics - summary: Get latest value metric grouped + summary: Retrieve the latest metric values grouped by dimension description: | - Retrieves an array of latest value for an aggregating metric, based on the `groupBy` options. - The `groupBy` can be `organization`, `repository` or a valid dimension for the requested metric. + Retrieve an array of the latest values for an aggregating metric, based on the `groupBy` options. + The `groupBy` can be `organization`, `repository`, or a valid dimension for the requested metric. **Note:** - It does not work for accumulating metrics, such as fixed issues @@ -4592,9 +4922,9 @@ paths: post: tags: - metrics - summary: Get a period value metric grouped + summary: Retrieve metric value for a specific period description: | - Retrieves the value for a metric, for a specific period, marked by its start date. + Retrieve the value for a metric for a specific period, identified by its start date. **Notes:** - Aggregating metrics provide the average value. @@ -4633,10 +4963,10 @@ paths: post: tags: - metrics - summary: Get a period value metric grouped + summary: Retrieve metric values for a specific period grouped by dimension description: | - Retrieves an array of latest values for a metric, for a specific period, marked by its start date, - grouped accordingly to the `groupBy` field. The `groupBy` can be `organization`, `repository` or a + Retrieve an array of values for a metric for a specific period, identified by its start date, + grouped according to the `groupBy` field. The `groupBy` can be `organization`, `repository`, or a valid dimension for the requested metric. **Notes:** @@ -4676,15 +5006,16 @@ paths: post: tags: - metrics - summary: Get a period value metric grouped + summary: Retrieve metric values for a time range description: | - Retrieves a specific metric's values for a given time range. The response includes values grouped by + Retrieve a specific metric's values for a given time range. The response includes values grouped by period date and optionally by an additional `groupBy` parameter. The `groupBy` can be `organization`, - `repository` or a valid dimension for the requested metric. + `repository`, or a valid dimension for the requested metric. **Notes:** - Aggregating metrics provide the average value. - Accumulating metrics provide the sum, representing the total historical change. + - `period` can be used to control the time granularity of returned data (`day`, `week`, `month`). If omitted, the backend chooses a default. operationId: retrieveTimerangeMetricValues parameters: - $ref: '#/components/parameters/providerParam' @@ -4720,9 +5051,9 @@ paths: tags: - metrics summary: | - Returns metrics that are ready in each Organization in the Enterprise + Retrieve metrics that are ready for each organization in an enterprise description: | - Returns metrics that are ready for each Organization in the Enterprise. + Retrieve the list of metrics that have completed data collection for each organization in the enterprise. operationId: readyMetricsForEnterprise parameters: - $ref: '#/components/parameters/providerParam' @@ -4749,9 +5080,9 @@ paths: post: tags: - metrics - summary: Get latest value metrics for all organizations in enterprise + summary: Retrieve latest metric values for all organizations in an enterprise description: | - Retrieves the latest value for each organization in an enterprise for an aggregating metric, e.g. open issues. + Retrieve the latest value for each organization in an enterprise for an aggregating metric (e.g., open issues). **Note:** It does not work for accumulating metrics, such as fixed issues operationId: retrieveLatestMetricValueForEnterprise @@ -4787,9 +5118,9 @@ paths: post: tags: - metrics - summary: Get latest value metric grouped for all organizations in enterprise + summary: Retrieve latest metric values grouped by dimension for all organizations in an enterprise description: | - Retrieves an array of latest value for an aggregating metric for each organization in an enterprise, + Retrieve an array of the latest values for an aggregating metric for each organization in an enterprise, based on the `groupBy` options. The `groupBy` can be `organization` or a valid dimension for the requested metric. @@ -4830,9 +5161,9 @@ paths: post: tags: - metrics - summary: Get a period value metric grouped for all organizations in enterprise + summary: Retrieve metric values for a specific period for all organizations in an enterprise description: | - Retrieves the value for a metric for each organization in an enterprise, for a specific period, marked by its start date. + Retrieve the value for a metric for each organization in an enterprise, for a specific period, identified by its start date. **Notes:** - Aggregating metrics provide the average value. @@ -4872,10 +5203,10 @@ paths: post: tags: - metrics - summary: Get a period value metric grouped for all organizations in enterprise + summary: Retrieve metric values grouped by dimension for a specific period for all organizations in an enterprise description: | - Retrieves an array of latest values for a metric, for each organization in an enterprise, - for a specific period, marked by its start date, grouped accordingly to the `groupBy` field. + Retrieve an array of values for a metric for each organization in an enterprise, + for a specific period, identified by its start date, grouped according to the `groupBy` field. The `groupBy` can be `organization` or a valid dimension for the requested metric. **Notes:** @@ -4916,15 +5247,16 @@ paths: post: tags: - metrics - summary: Get a period value metric grouped for all organizations in enterprise + summary: Retrieve metric values for a time range for all organizations in an enterprise description: | - Retrieves a specific metric's values for each organization in an enterprise, for a given time range. The response includes values grouped by + Retrieve a specific metric's values for each organization in an enterprise, for a given time range. The response includes values grouped by period date and optionally by an additional `groupBy` parameter. The `groupBy` can be `organization` or a valid dimension for the requested metric. **Notes:** - Aggregating metrics provide the average value. - Accumulating metrics provide the sum, representing the total historical change. - It does not allow grouping by repository (disabled) + - `period` can be used to control the time granularity of returned data (`day`, `week`, `month`). If omitted, the backend chooses a default. operationId: retrieveTimerangeMetricValuesForEnterprise parameters: - $ref: '#/components/parameters/providerParam' @@ -4971,6 +5303,7 @@ paths: - $ref: '#/components/parameters/remoteOrganizationNameParam' - $ref: '#/components/parameters/repositoryNameParam' - $ref: '#/components/parameters/branchNameParam' + - $ref: '#/components/parameters/filesPathParam' - $ref: '#/components/parameters/filesSearchFilter' - $ref: '#/components/parameters/filesSortParam' - $ref: '#/components/parameters/directionParam' @@ -4994,6 +5327,81 @@ paths: '500': $ref: '#/components/responses/InternalServerError' x-jvm-package: repository + /organizations/{provider}/{remoteOrganizationName}/repositories/{repositoryName}/directories: + get: + tags: + - repository + summary: List folders in a repository + description: | + Returns the most recent analysis information for the folders directly inside a path of a repository, with metrics aggregated over every file in each folder's subtree. + Use the `path` parameter to list the folders inside a folder; when absent or empty, the folders at the repository root are returned. + operationId: listDirectories + parameters: + - $ref: '#/components/parameters/providerParam' + - $ref: '#/components/parameters/remoteOrganizationNameParam' + - $ref: '#/components/parameters/repositoryNameParam' + - $ref: '#/components/parameters/branchNameParam' + - $ref: '#/components/parameters/directoriesPathParam' + - $ref: '#/components/parameters/filesSortParam' + - $ref: '#/components/parameters/directionParam' + - $ref: '#/components/parameters/cursorParam' + - $ref: '#/components/parameters/limitParam' + responses: + '200': + description: List of folders in the repository + content: + application/json: + schema: + $ref: '#/components/schemas/DirectoryListResponse' + '400': + $ref: '#/components/responses/BadRequest' + '401': + $ref: '#/components/responses/Unauthorized' + '404': + $ref: '#/components/responses/NotFound' + '500': + $ref: '#/components/responses/InternalServerError' + x-jvm-package: repository + /organizations/{provider}/{remoteOrganizationName}/repositories/{repositoryName}/ignored-files: + get: + tags: + - repository + summary: List ignored files in a repository + description: | + Returns the most recent ignored files information. + + **Note:** When the repository has a Codacy configuration file 'hasCodacyConfigurationFile', this list of files + are read-only, as they were ignored during the most recent analysis based on the configuration file + operationId: listIgnoredFiles + parameters: + - $ref: '#/components/parameters/providerParam' + - $ref: '#/components/parameters/remoteOrganizationNameParam' + - $ref: '#/components/parameters/repositoryNameParam' + - $ref: '#/components/parameters/branchNameParam' + - $ref: '#/components/parameters/filesSearchFilter' + - $ref: '#/components/parameters/cursorParam' + - $ref: '#/components/parameters/limitParam' + responses: + '200': + description: List of ignored files in the repository + content: + application/json: + schema: + $ref: '#/components/schemas/IgnoredFileListResponse' + '400': + $ref: '#/components/responses/BadRequest' + '401': + $ref: '#/components/responses/Unauthorized' + '404': + $ref: '#/components/responses/NotFound' + '422': + $ref: '#/components/responses/UnprocessableEntity' + '500': + $ref: '#/components/responses/InternalServerError' + security: + - ApiKeyAuth: [] + - ProjectTokenAuth: [] + x-jvm-package: repository /organizations/{provider}/{remoteOrganizationName}/repositories/{repositoryName}/files/{fileId}: get: tags: @@ -5144,7 +5552,9 @@ paths: post: tags: - coding standards - summary: Create a draft coding standard for an organization. To promote the draft coding standard to effective coding standard, see [promoteDraftCodingStandard](#promotedraftcodingstandard) + summary: Create a draft coding standard for an organization + description: | + To promote the draft coding standard to an effective coding standard, see [promoteDraftCodingStandard](#promotedraftcodingstandard). operationId: createCodingStandard parameters: - $ref: '#/components/parameters/providerParam' @@ -5187,7 +5597,7 @@ paths: post: tags: - coding standards - summary: Create a compliance standard for an organization. + summary: Create a compliance standard for an organization operationId: createComplianceStandard parameters: - $ref: '#/components/parameters/providerParam' @@ -5325,7 +5735,7 @@ paths: post: tags: - coding standards - summary: Duplicates a coding standard + summary: Duplicate a coding standard operationId: duplicateCodingStandard parameters: - $ref: '#/components/parameters/providerParam' @@ -5468,7 +5878,7 @@ paths: get: tags: - coding standards - summary: Patterns overview for a coding standard tool. + summary: Get patterns overview for a coding standard tool operationId: codingStandardToolPatternsOverview parameters: - $ref: '#/components/parameters/providerParam' @@ -5506,7 +5916,7 @@ paths: post: tags: - coding standards - summary: Bulk updates the code patterns of a tool in a coding standard. + summary: Bulk update the code patterns of a tool in a coding standard description: | Use filters to specify the code patterns to update, or omit the filters to update all code patterns. operationId: updateCodingStandardPatterns @@ -5551,7 +5961,7 @@ paths: patch: tags: - coding standards - summary: Configure a tool in a draft coding standard. + summary: Configure a tool in a draft coding standard description: | Toggle a tool and configure its code patterns in a draft coding standard. Only the code patterns included in the body are updated, and if there are none only the enabled status of the tool is set. @@ -5787,7 +6197,7 @@ paths: - $ref: '#/components/parameters/remoteOrganizationNameParam' - $ref: '#/components/parameters/gatePolicyId' requestBody: - description: The new value for the name, is default option, or quality gates of the gate policy + description: The new values for the name, default status, or quality gates of the gate policy content: application/json: schema: @@ -6045,8 +6455,9 @@ paths: post: tags: - coding standards - summary: Promote a draft coding standard to an effective coding standard. If the draft coding standard is marked as default, it becomes the new default coding standard - description: Returns the result of applying the coding standard to the repositories. + summary: Promote a draft coding standard to an effective coding standard + description: | + If the draft coding standard is marked as default, it becomes the new default coding standard. The response includes the result of applying the coding standard to the repositories. operationId: promoteDraftCodingStandard parameters: - $ref: '#/components/parameters/providerParam' @@ -6079,6 +6490,9 @@ paths: tags: - repository summary: List the [repository API tokens](https://docs.codacy.com/codacy-api/api-tokens/) + description: | + Each token reports its name, expiration and creation date. Tokens created before creation dates were + recorded have no `createdAt` operationId: listRepositoryApiTokens parameters: - $ref: '#/components/parameters/providerParam' @@ -6111,6 +6525,12 @@ paths: - $ref: '#/components/parameters/providerParam' - $ref: '#/components/parameters/remoteOrganizationNameParam' - $ref: '#/components/parameters/repositoryNameParam' + requestBody: + required: false + content: + application/json: + schema: + $ref: '#/components/schemas/RepositoryApiTokenCreateRequest' responses: '201': description: Successful operation @@ -6129,6 +6549,38 @@ paths: '500': $ref: '#/components/responses/InternalServerError' x-jvm-package: repository + /organizations/{provider}/{remoteOrganizationName}/repositories/{repositoryName}/tokens/delete: + post: + tags: + - repository + summary: Delete multiple [repository API tokens](https://docs.codacy.com/codacy-api/api-tokens/) by id + description: Deletes the repository API tokens with the given ids + operationId: deleteRepositoryApiTokens + parameters: + - $ref: '#/components/parameters/providerParam' + - $ref: '#/components/parameters/remoteOrganizationNameParam' + - $ref: '#/components/parameters/repositoryNameParam' + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/RepositoryApiTokensDeleteRequest' + responses: + '204': + description: Successful operation + content: {} + '400': + $ref: '#/components/responses/BadRequest' + '401': + $ref: '#/components/responses/Unauthorized' + '404': + $ref: '#/components/responses/NotFound' + '422': + $ref: '#/components/responses/UnprocessableEntity' + '500': + $ref: '#/components/responses/InternalServerError' + x-jvm-package: repository /organizations/{provider}/{remoteOrganizationName}/repositories/{repositoryName}/tokens/{tokenId}: delete: tags: @@ -6160,7 +6612,7 @@ paths: tags: - repository - coverage - summary: Returns a list of the most recent coverage reports and their respective status + summary: List the most recent coverage reports and their status operationId: listCoverageReports parameters: - $ref: '#/components/parameters/providerParam' @@ -6185,28 +6637,27 @@ paths: '500': $ref: '#/components/responses/InternalServerError' x-jvm-package: repository - /organizations/{provider}/{remoteOrganizationName}/repositories/{repositoryName}/files/{filePath}/content: + /organizations/{provider}/{remoteOrganizationName}/repositories/{repositoryName}/commits/{commitUuid}/coverage/reports: get: tags: - - file - summary: | - Returns the content of the given file for a given commit reference. If the requested file is over 1MB, a 'PayloadTooLarge' error is returned. - operationId: getFileContent + - repository + - coverage + summary: List coverage reports for a commit + operationId: listCommitCoverageReports parameters: - $ref: '#/components/parameters/providerParam' - $ref: '#/components/parameters/remoteOrganizationNameParam' - $ref: '#/components/parameters/repositoryNameParam' - - $ref: '#/components/parameters/filePathParam' - - $ref: '#/components/parameters/startLineParam' - - $ref: '#/components/parameters/endLineParam' - - $ref: '#/components/parameters/commitRefParam' + - $ref: '#/components/parameters/commitUuid' + - $ref: '#/components/parameters/cursorParam' + - $ref: '#/components/parameters/limitParam' responses: '200': description: Successful operation content: application/json: schema: - $ref: '#/components/schemas/CodeBlockLineListResponse' + $ref: '#/components/schemas/CoverageReportEntryResponse' '400': $ref: '#/components/responses/BadRequest' '401': @@ -6215,29 +6666,31 @@ paths: $ref: '#/components/responses/Forbidden' '404': $ref: '#/components/responses/NotFound' - '413': - $ref: '#/components/responses/PayloadTooLarge' + '422': + $ref: '#/components/responses/UnprocessableEntity' '500': $ref: '#/components/responses/InternalServerError' - x-jvm-package: fileExtension - /organizations/{provider}/{remoteOrganizationName}/repositories/{repositoryName}/files/{fileId}/coverage: + x-jvm-package: repository + /organizations/{provider}/{remoteOrganizationName}/repositories/{repositoryName}/commits/{commitUuid}/coverage/reports/{reportUuid}: get: tags: - repository - summary: Get coverage information for a file in the head commit of a repository branch. - operationId: getFileCoverage + - coverage + summary: Get a coverage report with its contents + operationId: getCoverageReport parameters: - $ref: '#/components/parameters/providerParam' - $ref: '#/components/parameters/remoteOrganizationNameParam' - $ref: '#/components/parameters/repositoryNameParam' - - $ref: '#/components/parameters/fileIdParam' + - $ref: '#/components/parameters/commitUuid' + - $ref: '#/components/parameters/reportUuid' responses: '200': - description: File Coverage + description: Successful operation content: application/json: schema: - $ref: '#/components/schemas/GetFileCoverageResponse' + $ref: '#/components/schemas/CoverageReportContentResponse' '400': $ref: '#/components/responses/BadRequest' '401': @@ -6251,24 +6704,90 @@ paths: '500': $ref: '#/components/responses/InternalServerError' x-jvm-package: repository - /organizations/{provider}/{remoteOrganizationName}/repositories/{repositoryName}/file: - patch: + /organizations/{provider}/{remoteOrganizationName}/repositories/{repositoryName}/files/{filePath}/content: + get: tags: - - repository - summary: Ignore or unignore a file - operationId: updateFileState + - file + summary: | + Returns the content of the given file for a given commit reference. If the requested file is over 1MB, a 'PayloadTooLarge' error is returned. + operationId: getFileContent parameters: - $ref: '#/components/parameters/providerParam' - $ref: '#/components/parameters/remoteOrganizationNameParam' - $ref: '#/components/parameters/repositoryNameParam' - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/FileStateBody' - required: true - responses: - '204': + - $ref: '#/components/parameters/filePathParam' + - $ref: '#/components/parameters/startLineParam' + - $ref: '#/components/parameters/endLineParam' + - $ref: '#/components/parameters/commitRefParam' + responses: + '200': + description: Successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/CodeBlockLineListResponse' + '400': + $ref: '#/components/responses/BadRequest' + '401': + $ref: '#/components/responses/Unauthorized' + '403': + $ref: '#/components/responses/Forbidden' + '404': + $ref: '#/components/responses/NotFound' + '413': + $ref: '#/components/responses/PayloadTooLarge' + '500': + $ref: '#/components/responses/InternalServerError' + x-jvm-package: fileExtension + /organizations/{provider}/{remoteOrganizationName}/repositories/{repositoryName}/files/{fileId}/coverage: + get: + tags: + - repository + summary: Get coverage information for a file in the head commit of a repository branch. + operationId: getFileCoverage + parameters: + - $ref: '#/components/parameters/providerParam' + - $ref: '#/components/parameters/remoteOrganizationNameParam' + - $ref: '#/components/parameters/repositoryNameParam' + - $ref: '#/components/parameters/fileIdParam' + responses: + '200': + description: File Coverage + content: + application/json: + schema: + $ref: '#/components/schemas/GetFileCoverageResponse' + '400': + $ref: '#/components/responses/BadRequest' + '401': + $ref: '#/components/responses/Unauthorized' + '403': + $ref: '#/components/responses/Forbidden' + '404': + $ref: '#/components/responses/NotFound' + '422': + $ref: '#/components/responses/UnprocessableEntity' + '500': + $ref: '#/components/responses/InternalServerError' + x-jvm-package: repository + /organizations/{provider}/{remoteOrganizationName}/repositories/{repositoryName}/file: + patch: + tags: + - repository + summary: Ignore or unignore a file + operationId: updateFileState + parameters: + - $ref: '#/components/parameters/providerParam' + - $ref: '#/components/parameters/remoteOrganizationNameParam' + - $ref: '#/components/parameters/repositoryNameParam' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/FileStateBody' + required: true + responses: + '204': description: Successful operation content: {} '400': @@ -6287,7 +6806,10 @@ paths: get: tags: - security - summary: 'Deprecated: use [SearchSecurityItems](#searchsecurityitems) instead. Returns a paginated list of security and risk management items for an organization. Repository filtering is limited to 100 names.' + summary: List security and risk management items for an organization + description: | + **Deprecated:** Use [searchSecurityItems](#searchsecurityitems) instead. Repository filtering is limited to 100 names. + deprecated: true operationId: listSecurityItems parameters: - $ref: '#/components/parameters/providerParam' @@ -6323,7 +6845,7 @@ paths: post: tags: - security - summary: Ignores a single item, with optional comment as to why + summary: Ignore a single item with an optional comment operationId: ignoreSecurityItem parameters: - $ref: '#/components/parameters/providerParam' @@ -6361,7 +6883,7 @@ paths: post: tags: - security - summary: Unignores a single item. Only previously ignored items can be unignored. + summary: Unignore a single item (only previously ignored items can be unignored) operationId: unignoreSecurityItem parameters: - $ref: '#/components/parameters/providerParam' @@ -6391,7 +6913,7 @@ paths: get: tags: - security - summary: Returns a single security and risk management finding. + summary: Get a single security and risk management finding operationId: getSecurityItem parameters: - $ref: '#/components/parameters/providerParam' @@ -6421,7 +6943,7 @@ paths: post: tags: - security - summary: Returns a paginated list of security and risk management items for an organization. + summary: List security and risk management items for an organization operationId: searchSecurityItems parameters: - $ref: '#/components/parameters/providerParam' @@ -6462,7 +6984,10 @@ paths: get: tags: - security - summary: 'Deprecated: use [SearchSecurityDashboard](#searchsecuritydashboard) instead. Returns the metrics for the security and risk management dashboard. Repository filtering is limited to 100 names.' + summary: Get metrics for the security and risk management dashboard + description: | + **Deprecated:** Use [searchSecurityDashboard](#searchsecuritydashboard) instead. Repository filtering is limited to 100 names. + deprecated: true operationId: getSecurityDashboard parameters: - $ref: '#/components/parameters/providerParam' @@ -6494,7 +7019,7 @@ paths: post: tags: - security - summary: Returns the metrics for the security and risk management dashboard. + summary: Get metrics for the security and risk management dashboard operationId: searchSecurityDashboard parameters: - $ref: '#/components/parameters/providerParam' @@ -6531,7 +7056,8 @@ paths: post: tags: - security - summary: Returns a list of repositories with security findings. If no filter is specified, only the 10 repositories with the most findings are returned. + summary: List repositories with security findings + description: If no filter is specified, only the 10 repositories with the most findings are returned. operationId: searchSecurityDashboardRepositories parameters: - $ref: '#/components/parameters/providerParam' @@ -6568,7 +7094,7 @@ paths: post: tags: - security - summary: Returns the evolution of security findings over time. + summary: Get the evolution of security findings over time operationId: searchSecurityDashboardHistory parameters: - $ref: '#/components/parameters/providerParam' @@ -6605,7 +7131,8 @@ paths: post: tags: - security - summary: Returns a list of security categories with findings. If no filter is specified, only the 10 categories with the most findings are returned. + summary: List security categories with findings + description: If no filter is specified, only the 10 categories with the most findings are returned. operationId: searchSecurityDashboardCategories parameters: - $ref: '#/components/parameters/providerParam' @@ -6710,7 +7237,8 @@ paths: get: tags: - security - summary: Consult uploaded dynamic application security testing (DAST) scan reports and their state. Results are sorted by their submission date, from latest to earliest. + summary: List uploaded DAST scan reports and their state + description: Results are sorted by submission date, from latest to earliest. operationId: listDastReports parameters: - $ref: '#/components/parameters/providerParam' @@ -6741,7 +7269,7 @@ paths: get: tags: - security - summary: Returns a paginated list of organization admins and security managers. + summary: List organization admins and security managers operationId: listSecurityManagers parameters: - $ref: '#/components/parameters/providerParam' @@ -6771,7 +7299,7 @@ paths: post: tags: - security - summary: Assign the Security Manager role to an organization member. + summary: Assign the Security Manager role to an organization member operationId: postSecurityManager parameters: - $ref: '#/components/parameters/providerParam' @@ -6805,7 +7333,7 @@ paths: delete: tags: - security - summary: Revoke the Security Manager role from an organization member. + summary: Revoke the Security Manager role from an organization member operationId: deleteSecurityManager parameters: - $ref: '#/components/parameters/providerParam' @@ -6832,7 +7360,7 @@ paths: get: tags: - security - summary: Return a list of organization repositories that have security issues. + summary: List organization repositories that have security issues operationId: listSecurityRepositories parameters: - $ref: '#/components/parameters/providerParam' @@ -6864,7 +7392,7 @@ paths: get: tags: - security - summary: Return a list of security subcategories that have security issues. + summary: List security subcategories that have security issues operationId: listSecurityCategories parameters: - $ref: '#/components/parameters/providerParam' @@ -7006,7 +7534,7 @@ paths: post: tags: - sbom - summary: Return a list of repositories with SBOM dependency information. + summary: List repositories with SBOM dependency information operationId: searchSbomRepositories parameters: - $ref: '#/components/parameters/providerParam' @@ -7057,7 +7585,7 @@ paths: x-jvm-package: sbom tags: - sbom - summary: Returns a presigned URL for the latest SBOM of the repository. + summary: Get a presigned URL for the latest SBOM of the repository operationId: getRepositorySbomPresignedUrl parameters: - $ref: '#/components/parameters/providerParam' @@ -7078,11 +7606,166 @@ paths: $ref: '#/components/responses/NotFound' '500': $ref: '#/components/responses/InternalServerError' + /organizations/{provider}/{remoteOrganizationName}/image-sboms: + post: + x-jvm-package: sbom + tags: + - sbom + summary: Upload an SBOM for a Docker image + operationId: uploadImageSbom + parameters: + - $ref: '#/components/parameters/providerParam' + - $ref: '#/components/parameters/remoteOrganizationNameParam' + requestBody: + required: true + content: + multipart/form-data: + schema: + type: object + properties: + sbom: + type: string + description: SBOM file (SPDX or CycloneDX format) + format: binary + imageName: + type: string + description: Name of the Docker image + tag: + type: string + description: Tag of the Docker image + repositoryName: + type: string + description: Repository name + environment: + type: string + description: Environment where the image is deployed + required: + - sbom + - imageName + - tag + responses: + '204': + description: Successful operation + '400': + $ref: '#/components/responses/BadRequest' + '401': + $ref: '#/components/responses/Unauthorized' + '403': + $ref: '#/components/responses/Forbidden' + '404': + $ref: '#/components/responses/NotFound' + '409': + $ref: '#/components/responses/Conflict' + '500': + $ref: '#/components/responses/InternalServerError' + /organizations/{provider}/{remoteOrganizationName}/image-sboms/{imageName}: + delete: + tags: + - sbom + summary: Delete all SBOMs for a given image + operationId: deleteImageSboms + parameters: + - $ref: '#/components/parameters/providerParam' + - $ref: '#/components/parameters/remoteOrganizationNameParam' + - $ref: '#/components/parameters/imageNameParam' + responses: + '204': + description: Successful operation + '400': + $ref: '#/components/responses/BadRequest' + '401': + $ref: '#/components/responses/Unauthorized' + '404': + $ref: '#/components/responses/NotFound' + '500': + $ref: '#/components/responses/InternalServerError' + x-jvm-package: sbom + /organizations/{provider}/{remoteOrganizationName}/image-sboms/{imageName}/tags/{tag}: + delete: + tags: + - sbom + summary: Delete SBOM for a given image/tag combination + operationId: deleteImageTag + parameters: + - $ref: '#/components/parameters/providerParam' + - $ref: '#/components/parameters/remoteOrganizationNameParam' + - $ref: '#/components/parameters/imageNameParam' + - $ref: '#/components/parameters/imageTagParam' + responses: + '204': + description: Successful operation + '400': + $ref: '#/components/responses/BadRequest' + '401': + $ref: '#/components/responses/Unauthorized' + '404': + $ref: '#/components/responses/NotFound' + '500': + $ref: '#/components/responses/InternalServerError' + x-jvm-package: sbom + /organizations/{provider}/{remoteOrganizationName}/images: + get: + x-jvm-package: sbom + tags: + - sbom + summary: List Docker images for an organization + operationId: listOrganizationImages + parameters: + - $ref: '#/components/parameters/providerParam' + - $ref: '#/components/parameters/remoteOrganizationNameParam' + - $ref: '#/components/parameters/cursorParam' + - $ref: '#/components/parameters/limitParam' + responses: + '200': + description: Successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/ListImagesResponse' + '400': + $ref: '#/components/responses/BadRequest' + '401': + $ref: '#/components/responses/Unauthorized' + '404': + $ref: '#/components/responses/NotFound' + '500': + $ref: '#/components/responses/InternalServerError' + /organizations/{provider}/{remoteOrganizationName}/images/{imageName}/tags: + get: + x-jvm-package: sbom + tags: + - sbom + summary: List Docker image tags for an organization + operationId: listImageTags + parameters: + - $ref: '#/components/parameters/providerParam' + - $ref: '#/components/parameters/remoteOrganizationNameParam' + - $ref: '#/components/parameters/imageNameParam' + - $ref: '#/components/parameters/cursorParam' + - $ref: '#/components/parameters/limitParam' + responses: + '200': + description: Successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/ListImageTagsResponse' + '400': + $ref: '#/components/responses/BadRequest' + '401': + $ref: '#/components/responses/Unauthorized' + '404': + $ref: '#/components/responses/NotFound' + '500': + $ref: '#/components/responses/InternalServerError' /organizations/{provider}/{remoteOrganizationName}/repositories/{repositoryName}/integrations/jira/tickets: post: tags: - jira - summary: Create Jira Ticket - Deprecated version + summary: Create a Jira ticket + description: | + **Deprecated:** Use [createJiraTicket](#createjiraticket) instead. + deprecated: true operationId: createJiraTicketDeprecated parameters: - $ref: '#/components/parameters/providerParam' @@ -7153,7 +7836,7 @@ paths: post: tags: - jira - summary: Create Jira Ticket + summary: Create a Jira ticket operationId: createJiraTicket parameters: - $ref: '#/components/parameters/providerParam' @@ -7191,7 +7874,7 @@ paths: delete: tags: - jira - summary: Unlink Repository Jira Ticket + summary: Unlink a Jira ticket from a repository operationId: unlinkRepositoryJiraTicket parameters: - $ref: '#/components/parameters/providerParam' @@ -7225,10 +7908,9 @@ paths: x-jvm-package: jira /organizations/{provider}/{remoteOrganizationName}/integrations/jira: get: - summary: Return the Jira integration of the organization. + summary: Get the Jira integration of the organization tags: - organization - description: Return the Jira integration of the organization. operationId: getJiraIntegration parameters: - $ref: '#/components/parameters/providerParam' @@ -7256,10 +7938,9 @@ paths: $ref: '#/components/responses/BadGateway' x-jvm-package: organization put: - summary: Create or Update the Jira integration of the organization. + summary: Create or update the Jira integration of the organization tags: - organization - description: Create or Update the Jira integration of the organization. operationId: createOrUpdateJiraIntegration parameters: - $ref: '#/components/parameters/oauthCodeParam' @@ -7293,7 +7974,6 @@ paths: summary: Delete the Jira integration of the organization and associated resources tags: - organization - description: Delete the Jira integration of the organization and associated resources. operationId: deleteJiraIntegration parameters: - $ref: '#/components/parameters/providerParam' @@ -7321,7 +8001,7 @@ paths: get: tags: - jira - summary: Get available Jira projects for the organization. + summary: Get available Jira projects for the organization operationId: getAvailableJiraProjects parameters: - $ref: '#/components/parameters/providerParam' @@ -7355,7 +8035,7 @@ paths: get: tags: - jira - summary: Get available issue types for a Jira project. + summary: Get available issue types for a Jira project operationId: getJiraProjectIssueTypes parameters: - $ref: '#/components/parameters/providerParam' @@ -7389,7 +8069,7 @@ paths: get: tags: - jira - summary: Get available field by issue type id for a Jira project. + summary: Get available fields by issue type for a Jira project operationId: getJiraProjectIssueFields parameters: - $ref: '#/components/parameters/providerParam' @@ -7422,10 +8102,9 @@ paths: x-jvm-package: jira /organizations/{provider}/{remoteOrganizationName}/integrations/slack: get: - summary: Return the Slack integration of the organization. + summary: Get the Slack integration of the organization tags: - organization - description: Return the Slack integration of the organization. operationId: getSlackIntegration parameters: - $ref: '#/components/parameters/providerParam' @@ -7453,10 +8132,9 @@ paths: $ref: '#/components/responses/BadGateway' x-jvm-package: organization put: - summary: Create or Update the Slack integration of the organization. + summary: Create or update the Slack integration of the organization tags: - organization - description: Create or update the Slack integration of the organization. operationId: createOrUpdateSlackIntegration parameters: - $ref: '#/components/parameters/providerParam' @@ -7494,7 +8172,6 @@ paths: summary: Delete the Slack integration of the organization and associated resources tags: - organization - description: Delete the Slack integration of the organization and associated resources. operationId: deleteSlackIntegration parameters: - $ref: '#/components/parameters/providerParam' @@ -7518,24 +8195,22 @@ paths: '502': $ref: '#/components/responses/BadGateway' x-jvm-package: organization - /organizations/{provider}/{remoteOrganizationName}/repositories/{repositoryName}/pull-requests/{pullRequestNumber}/diff: + /organizations/{provider}/{remoteOrganizationName}/integrations/webhooks: get: + summary: List webhook endpoints of the organization tags: - - repository - summary: Returns the human-readable Git diff of a pull request - operationId: getPullRequestDiff + - webhooks + operationId: listWebhookEndpoints parameters: - $ref: '#/components/parameters/providerParam' - $ref: '#/components/parameters/remoteOrganizationNameParam' - - $ref: '#/components/parameters/repositoryNameParam' - - $ref: '#/components/parameters/pullRequestNumberParam' responses: '200': description: Successful operation content: application/json: schema: - $ref: '#/components/schemas/DiffResponse' + $ref: '#/components/schemas/WebhookEndpointList' '400': $ref: '#/components/responses/BadRequest' '401': @@ -7548,25 +8223,30 @@ paths: $ref: '#/components/responses/UnprocessableEntity' '500': $ref: '#/components/responses/InternalServerError' - x-jvm-package: repository - /coverage/organizations/{provider}/{remoteOrganizationName}/repositories/{repositoryName}/pull-requests/{pullRequestNumber}/diff: - get: + '502': + $ref: '#/components/responses/BadGateway' + x-jvm-package: webhooks + post: + summary: Add a webhook endpoint to the organization tags: - - coverage - summary: 'Deprecated: use [GetDiffBetweenCommits](#getDiffBetweenCommits) instead. Returns the human-readable Git diff of a pull request' - operationId: getPullRequestGitDiff + - webhooks + operationId: createWebhookEndpoint parameters: - $ref: '#/components/parameters/providerParam' - $ref: '#/components/parameters/remoteOrganizationNameParam' - - $ref: '#/components/parameters/repositoryNameParam' - - $ref: '#/components/parameters/pullRequestNumberParam' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/CreateWebhookEndpointBody' + required: true responses: - '200': + '201': description: Successful operation content: application/json: schema: - $ref: '#/components/schemas/DiffResponse' + $ref: '#/components/schemas/WebhookEndpointCreated' '400': $ref: '#/components/responses/BadRequest' '401': @@ -7575,29 +8255,30 @@ paths: $ref: '#/components/responses/Forbidden' '404': $ref: '#/components/responses/NotFound' + '409': + $ref: '#/components/responses/Conflict' '422': $ref: '#/components/responses/UnprocessableEntity' '500': $ref: '#/components/responses/InternalServerError' - x-jvm-package: coverage - /organizations/{provider}/{remoteOrganizationName}/repositories/{repositoryName}/commits/{commitUuid}/diff: - get: + '502': + $ref: '#/components/responses/BadGateway' + x-jvm-package: webhooks + x-codegen-request-body-name: createWebhookEndpointBody + /organizations/{provider}/{remoteOrganizationName}/integrations/webhooks/{webhookId}: + delete: + summary: Delete a webhook endpoint of the organization tags: - - repository - summary: Returns the human-readable Git diff of a commit - operationId: getCommitDiff + - webhooks + operationId: deleteWebhookEndpoint parameters: - $ref: '#/components/parameters/providerParam' - $ref: '#/components/parameters/remoteOrganizationNameParam' - - $ref: '#/components/parameters/repositoryNameParam' - - $ref: '#/components/parameters/commitUuid' + - $ref: '#/components/parameters/webhookIdParam' responses: - '200': + '204': description: Successful operation - content: - application/json: - schema: - $ref: '#/components/schemas/DiffResponse' + content: {} '400': $ref: '#/components/responses/BadRequest' '401': @@ -7610,19 +8291,20 @@ paths: $ref: '#/components/responses/UnprocessableEntity' '500': $ref: '#/components/responses/InternalServerError' - x-jvm-package: repository - /organizations/{provider}/{remoteOrganizationName}/repositories/{repositoryName}/base/{baseCommitUuid}/head/{headCommitUuid}/diff: + '502': + $ref: '#/components/responses/BadGateway' + x-jvm-package: webhooks + /organizations/{provider}/{remoteOrganizationName}/repositories/{repositoryName}/pull-requests/{pullRequestNumber}/diff: get: tags: - repository - summary: Returns the human-readable Git diff between a head commit and a base commit - operationId: getDiffBetweenCommits + summary: Get the human-readable Git diff of a pull request + operationId: getPullRequestDiff parameters: - $ref: '#/components/parameters/providerParam' - $ref: '#/components/parameters/remoteOrganizationNameParam' - $ref: '#/components/parameters/repositoryNameParam' - - $ref: '#/components/parameters/baseCommitUuid' - - $ref: '#/components/parameters/headCommitUuid' + - $ref: '#/components/parameters/pullRequestNumberParam' responses: '200': description: Successful operation @@ -7643,13 +8325,110 @@ paths: '500': $ref: '#/components/responses/InternalServerError' x-jvm-package: repository - /reports/organizations/{provider}/{remoteOrganizationName}/security/items: + /coverage/organizations/{provider}/{remoteOrganizationName}/repositories/{repositoryName}/pull-requests/{pullRequestNumber}/diff: get: tags: - - reports - summary: Generate a CSV file listing all security and risk management items for an organization. - operationId: getReportSecurityItems - parameters: + - coverage + summary: Get the human-readable Git diff of a pull request + description: | + **Deprecated:** Use [getDiffBetweenCommits](#getdiffbetweencommits) instead. + deprecated: true + operationId: getPullRequestGitDiff + parameters: + - $ref: '#/components/parameters/providerParam' + - $ref: '#/components/parameters/remoteOrganizationNameParam' + - $ref: '#/components/parameters/repositoryNameParam' + - $ref: '#/components/parameters/pullRequestNumberParam' + responses: + '200': + description: Successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/DiffResponse' + '400': + $ref: '#/components/responses/BadRequest' + '401': + $ref: '#/components/responses/Unauthorized' + '403': + $ref: '#/components/responses/Forbidden' + '404': + $ref: '#/components/responses/NotFound' + '422': + $ref: '#/components/responses/UnprocessableEntity' + '500': + $ref: '#/components/responses/InternalServerError' + x-jvm-package: coverage + /organizations/{provider}/{remoteOrganizationName}/repositories/{repositoryName}/commits/{commitUuid}/diff: + get: + tags: + - repository + summary: Get the human-readable Git diff of a commit + operationId: getCommitDiff + parameters: + - $ref: '#/components/parameters/providerParam' + - $ref: '#/components/parameters/remoteOrganizationNameParam' + - $ref: '#/components/parameters/repositoryNameParam' + - $ref: '#/components/parameters/commitUuid' + responses: + '200': + description: Successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/DiffResponse' + '400': + $ref: '#/components/responses/BadRequest' + '401': + $ref: '#/components/responses/Unauthorized' + '403': + $ref: '#/components/responses/Forbidden' + '404': + $ref: '#/components/responses/NotFound' + '422': + $ref: '#/components/responses/UnprocessableEntity' + '500': + $ref: '#/components/responses/InternalServerError' + x-jvm-package: repository + /organizations/{provider}/{remoteOrganizationName}/repositories/{repositoryName}/base/{baseCommitUuid}/head/{headCommitUuid}/diff: + get: + tags: + - repository + summary: Get the human-readable Git diff between a head commit and a base commit + operationId: getDiffBetweenCommits + parameters: + - $ref: '#/components/parameters/providerParam' + - $ref: '#/components/parameters/remoteOrganizationNameParam' + - $ref: '#/components/parameters/repositoryNameParam' + - $ref: '#/components/parameters/baseCommitUuid' + - $ref: '#/components/parameters/headCommitUuid' + responses: + '200': + description: Successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/DiffResponse' + '400': + $ref: '#/components/responses/BadRequest' + '401': + $ref: '#/components/responses/Unauthorized' + '403': + $ref: '#/components/responses/Forbidden' + '404': + $ref: '#/components/responses/NotFound' + '422': + $ref: '#/components/responses/UnprocessableEntity' + '500': + $ref: '#/components/responses/InternalServerError' + x-jvm-package: repository + /reports/organizations/{provider}/{remoteOrganizationName}/security/items: + get: + tags: + - reports + summary: Generate a CSV file listing all security and risk management items for an organization. + operationId: getReportSecurityItems + parameters: - $ref: '#/components/parameters/providerParam' - $ref: '#/components/parameters/remoteOrganizationNameParam' responses: @@ -7683,6 +8462,96 @@ paths: '500': $ref: '#/components/responses/InternalServerError' x-jvm-package: reports.security.streaming + /reports/organizations/{provider}/{remoteOrganizationName}/security/items/search: + post: + tags: + - reports + summary: Generate a filtered CSV export of security and risk management items + operationId: searchReportSecurityItems + parameters: + - $ref: '#/components/parameters/providerParam' + - $ref: '#/components/parameters/remoteOrganizationNameParam' + requestBody: + description: Optional filters for the CSV export + required: false + content: + application/json: + schema: + $ref: '#/components/schemas/PostReportSecurityItemsBody' + responses: + '200': + description: CSV file containing the filtered security and risk management items + headers: + Transfer-Encoding: + description: See https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Transfer-Encoding + schema: + type: string + enum: + - chunked + Content-Disposition: + description: See https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Disposition + schema: + type: string + content: + text/csv: + schema: + type: string + '400': + $ref: '#/components/responses/BadRequest' + '401': + $ref: '#/components/responses/Unauthorized' + '404': + $ref: '#/components/responses/NotFound' + '422': + $ref: '#/components/responses/UnprocessableEntity' + '500': + $ref: '#/components/responses/InternalServerError' + x-jvm-package: reports.security.streaming + /reports/organizations/{provider}/{remoteOrganizationName}/sbom/dependencies/search: + post: + tags: + - reports + summary: Search SBOM dependencies for the organization in CSV format + operationId: searchReportSbomDependencies + parameters: + - $ref: '#/components/parameters/providerParam' + - $ref: '#/components/parameters/remoteOrganizationNameParam' + requestBody: + description: Optional filters for report generation + required: false + content: + application/json: + schema: + $ref: '#/components/schemas/SearchSbomDependenciesBody' + responses: + '200': + description: Successful operation + headers: + Transfer-Encoding: + description: See https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Transfer-Encoding + schema: + type: string + enum: + - chunked + Content-Disposition: + description: See https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Disposition + schema: + type: string + content: + text/csv: + schema: + type: string + '400': + $ref: '#/components/responses/BadRequest' + '401': + $ref: '#/components/responses/Unauthorized' + '404': + $ref: '#/components/responses/NotFound' + '422': + $ref: '#/components/responses/UnprocessableEntity' + '500': + $ref: '#/components/responses/InternalServerError' + x-jvm-package: reports.sbom.streaming /organizations/{provider}/{remoteOrganizationName}/commit/{commitId}: get: tags: @@ -7747,7 +8616,7 @@ paths: post: tags: - session - summary: Heartbeat endpoint to keep the session alive + summary: Send a heartbeat to keep the session alive operationId: heartbeat requestBody: content: @@ -7776,7 +8645,8 @@ paths: get: tags: - analysis - summary: Check if the repository has quick fix suggestions for given branch. If branch is not provided, the default branch is used. + summary: Check if the repository has quick fix suggestions for a branch + description: If branch is not provided, the default branch is used. operationId: hasQuickfixSuggestions parameters: - $ref: '#/components/parameters/providerParam' @@ -7812,7 +8682,8 @@ paths: get: tags: - analysis - summary: Get the quickfixes for the issues in patch format. If branch is not provided, the default branch is used. + summary: Get quickfixes for issues in patch format + description: If branch is not provided, the default branch is used. operationId: getQuickfixesPatch parameters: - $ref: '#/components/parameters/providerParam' @@ -7848,7 +8719,8 @@ paths: get: tags: - analysis - summary: Get the quickfixes for the pull request issues in patch format. If branch is not provided, the default branch is used. + summary: Get quickfixes for pull request issues in patch format + description: If branch is not provided, the default branch is used. operationId: getPullRequestQuickfixesPatch parameters: - $ref: '#/components/parameters/providerParam' @@ -7884,8 +8756,9 @@ paths: get: tags: - organization - summary: Retrieve the audit logs for the organization. Only available on [Business plan](https://www.codacy.com/pricing). - description: Requires organization admin or organization manager role. + summary: Retrieve the audit logs for the organization + description: | + Only available on [Business plan](https://www.codacy.com/pricing). Requires organization admin or organization manager role. operationId: listAuditLogsForOrganization parameters: - $ref: '#/components/parameters/providerParam' @@ -7918,7 +8791,7 @@ paths: get: tags: - segments - summary: Get the status of the segments synchronization. + summary: Get the status of the segments synchronization operationId: getSegmentsSyncStatus parameters: - $ref: '#/components/parameters/providerParam' @@ -7946,7 +8819,8 @@ paths: post: tags: - segments - summary: Synchronize the segments of the organization with the git provider. For Github Segments are the repositories custom properties. + summary: Synchronize the segments of the organization with the Git provider + description: For GitHub, segments are the repository custom properties operationId: syncSegments parameters: - $ref: '#/components/parameters/providerParam' @@ -7975,7 +8849,7 @@ paths: get: tags: - segments - summary: Get the segments keys of the organization. + summary: Get the segment keys for the organization operationId: getSegmentsKeys parameters: - $ref: '#/components/parameters/providerParam' @@ -8007,7 +8881,7 @@ paths: get: tags: - segments - summary: Get the segments keys with ids of the organization. + summary: Get the segment keys with IDs for the organization operationId: getSegmentsKeysWithIds parameters: - $ref: '#/components/parameters/providerParam' @@ -8039,7 +8913,10 @@ paths: get: tags: - segments - summary: This route is deprecated, use getSegments instead. + summary: Get segment values for a segment key + description: | + **Deprecated:** Use [getSegments](#getsegments) instead. + deprecated: true operationId: getSegmentsValues parameters: - $ref: '#/components/parameters/providerParam' @@ -8067,13 +8944,12 @@ paths: $ref: '#/components/responses/UnprocessableEntity' '500': $ref: '#/components/responses/InternalServerError' - deprecated: true x-jvm-package: segments /organizations/{provider}/{remoteOrganizationName}/segments/{segmentKey}/values: get: tags: - segments - summary: Get the segments of the organization and segment key. + summary: Get the segment values for the organization by segment key operationId: getSegments parameters: - $ref: '#/components/parameters/providerParam' @@ -8106,7 +8982,7 @@ paths: get: tags: - dast - summary: List configured DAST targets. + summary: List configured DAST targets operationId: getDastTargets parameters: - $ref: '#/components/parameters/providerParam' @@ -8136,7 +9012,7 @@ paths: post: tags: - dast - summary: Create a DAST target. + summary: Create a DAST target operationId: createDastTarget parameters: - $ref: '#/components/parameters/providerParam' @@ -8175,7 +9051,7 @@ paths: delete: tags: - dast - summary: Delete a DAST target. + summary: Delete a DAST target operationId: deleteDastTarget parameters: - $ref: '#/components/parameters/providerParam' @@ -8201,7 +9077,7 @@ paths: post: tags: - dast - summary: Enqueue a DAST analysis for the given target. + summary: Enqueue a DAST analysis for the given target operationId: analyzeDastTarget parameters: - $ref: '#/components/parameters/providerParam' @@ -8233,7 +9109,7 @@ paths: get: tags: - security - summary: Get the SLA configuration for an organization. + summary: Get the SLA configuration for an organization operationId: getSLAConfig parameters: - $ref: '#/components/parameters/providerParam' @@ -8259,7 +9135,7 @@ paths: put: tags: - security - summary: Update an SLA Configuration for the given organization. + summary: Update the SLA configuration for an organization operationId: updateSLAConfig parameters: - $ref: '#/components/parameters/providerParam' @@ -8293,7 +9169,7 @@ paths: get: tags: - enterprise - summary: Get the organizations of an enterprise. + summary: Get the organizations of an enterprise operationId: listEnterpriseOrganizations parameters: - $ref: '#/components/parameters/enterpriseNameParam' @@ -8386,7 +9262,6 @@ paths: tags: - enterprise summary: Get enterprise seats - description: List all seats of an enterprise operationId: listEnterpriseSeats parameters: - $ref: '#/components/parameters/providerParam' @@ -8419,8 +9294,7 @@ paths: tags: - reports x-jvm-package: reports.enterprise - summary: Get enterprise seats csv file - description: List all seats of an enterprise + summary: Get enterprise seats as a CSV file operationId: listEnterpriseSeatsCsv parameters: - $ref: '#/components/parameters/providerParam' @@ -8447,8 +9321,7 @@ paths: tags: - billing x-jvm-package: billing - summary: Retrieves the list of available plans in Codacy - description: Retrieves the list of available plans in Codacy + summary: List available plans in Codacy operationId: listPaymentPlans responses: '200': @@ -8489,86 +9362,441 @@ paths: $ref: '#/components/responses/UnprocessableEntity' '500': $ref: '#/components/responses/InternalServerError' -components: - securitySchemes: - ApiKeyAuth: - type: apiKey - description: Learn how to [generate an account API token](https://docs.codacy.com/codacy-api/api-tokens/#account-api-tokens) - name: api-token - in: header - schemas: - Version: - required: - - data - type: object - properties: - data: - type: string - ProblemLink: - required: - - name - - url - type: object - properties: - name: - type: string - example: Check our documentation - url: - type: string - example: https://docs.codacy.com/faq/troubleshooting/why-isnt-my-public-repository-being-analyzed/ - ApiError: - required: - - actions - - message - type: object - properties: - message: - type: string - innerMessage: - type: string - actions: - type: array - items: - $ref: '#/components/schemas/ProblemLink' - Unauthorized: - allOf: - - $ref: '#/components/schemas/ApiError' - - required: - - code - - error - type: object - properties: - error: - type: string - default: Unauthorized - code: - type: string - default: Unauthorized - UnprocessableEntity: - allOf: - - $ref: '#/components/schemas/ApiError' - - required: - - error - type: object - properties: - error: - type: string - default: UnprocessableEntity - InternalServerError: - allOf: - - $ref: '#/components/schemas/ApiError' - - required: - - error - type: object - properties: - error: - type: string - default: InternalServerError - PaginationInfo: - type: object - properties: - cursor: - type: string + /organizations/{provider}/{remoteOrganizationName}/ai-inventory/providers/summaries/search: + post: + tags: + - aiinventory + summary: List AI inventory provider summaries for an organization + description: | + Returns a paginated list of provider summaries for an organization. + Each summary aggregates resources, references, and repositories for one AI provider, + with a per-category-group repository breakdown + operationId: searchAiInventoryProviderSummaries + x-jvm-package: aiInventoryItems + x-codegen-request-body-name: searchAiInventoryProviderSummariesBody + parameters: + - $ref: '#/components/parameters/providerParam' + - $ref: '#/components/parameters/remoteOrganizationNameParam' + - $ref: '#/components/parameters/cursorParam' + - $ref: '#/components/parameters/limitParam' + requestBody: + description: Filters for AI inventory provider summaries + required: false + content: + application/json: + schema: + $ref: '#/components/schemas/AiInventoryFilter' + responses: + '200': + description: Successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/AiInventoryProviderSummariesResponse' + headers: + X-Maturity: + description: Experimental API. Subject to change in the near future. Do not use it in your workflow, scripts, etc. + schema: + type: string + enum: + - experimental + '400': + $ref: '#/components/responses/BadRequest' + '401': + $ref: '#/components/responses/Unauthorized' + '403': + $ref: '#/components/responses/Forbidden' + '404': + $ref: '#/components/responses/NotFound' + '500': + $ref: '#/components/responses/InternalServerError' + '501': + $ref: '#/components/responses/NotImplemented' + /organizations/{provider}/{remoteOrganizationName}/ai-inventory/providers/summary: + post: + tags: + - aiinventory + summary: Get AI inventory summary for a specific provider + description: | + Returns the summary for a specific AI provider (resource, reference, and + repository counts plus a per-category-group repository breakdown). + The provider name is given in the request body since it may contain spaces + or special characters (e.g. `GPT Engineer`) + operationId: getAiInventoryProviderSummary + x-jvm-package: aiInventoryItems + x-codegen-request-body-name: getAiInventoryProviderSummaryBody + parameters: + - $ref: '#/components/parameters/providerParam' + - $ref: '#/components/parameters/remoteOrganizationNameParam' + requestBody: + description: Required AI provider identity and optional filters scoping the summary + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/GetAiInventoryProviderSummaryBody' + responses: + '200': + description: Successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/AiInventoryProviderSummaryResponse' + headers: + X-Maturity: + description: Experimental API. Subject to change in the near future. Do not use it in your workflow, scripts, etc. + schema: + type: string + enum: + - experimental + '400': + $ref: '#/components/responses/BadRequest' + '401': + $ref: '#/components/responses/Unauthorized' + '403': + $ref: '#/components/responses/Forbidden' + '404': + $ref: '#/components/responses/NotFound' + '500': + $ref: '#/components/responses/InternalServerError' + '501': + $ref: '#/components/responses/NotImplemented' + /organizations/{provider}/{remoteOrganizationName}/ai-inventory/markers/summaries/search: + post: + tags: + - aiinventory + summary: List AI inventory marker summaries for an organization + description: | + Returns a paginated list of marker summaries for an organization. + Each summary represents a distinct inventory resource — a + (`categoryGroup`, `category`, `marker`) grouping — with reference and + repository counts. Typically called after picking a provider on the + provider summaries view; scope the result by passing `aiProviders` + (and/or `categoryGroups` for the tab filter) in the request body + operationId: searchAiInventoryMarkerSummaries + x-jvm-package: aiInventoryItems + x-codegen-request-body-name: searchAiInventoryMarkerSummariesBody + parameters: + - $ref: '#/components/parameters/providerParam' + - $ref: '#/components/parameters/remoteOrganizationNameParam' + - $ref: '#/components/parameters/cursorParam' + - $ref: '#/components/parameters/limitParam' + requestBody: + description: Filters for AI inventory marker summaries + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/AiInventoryFilter' + responses: + '200': + description: Successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/AiInventoryMarkerSummariesResponse' + headers: + X-Maturity: + description: Experimental API. Subject to change in the near future. Do not use it in your workflow, scripts, etc. + schema: + type: string + enum: + - experimental + '400': + $ref: '#/components/responses/BadRequest' + '401': + $ref: '#/components/responses/Unauthorized' + '403': + $ref: '#/components/responses/Forbidden' + '404': + $ref: '#/components/responses/NotFound' + '500': + $ref: '#/components/responses/InternalServerError' + '501': + $ref: '#/components/responses/NotImplemented' + /organizations/{provider}/{remoteOrganizationName}/ai-inventory/repositories/search: + post: + tags: + - aiinventory + summary: List repositories that have AI inventory items + description: | + Returns a paginated list of repositories that have AI inventory items + for an organization. Used to populate the Repositories filter dropdown + operationId: searchAiInventoryRepositories + x-jvm-package: aiInventoryItems + x-codegen-request-body-name: searchAiInventoryRepositoriesBody + parameters: + - $ref: '#/components/parameters/providerParam' + - $ref: '#/components/parameters/remoteOrganizationNameParam' + - $ref: '#/components/parameters/cursorParam' + - $ref: '#/components/parameters/limitParam' + requestBody: + description: Filters to scope the returned repositories + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/AiInventoryFilter' + responses: + '200': + description: Successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/AiInventoryRepositoryListResponse' + headers: + X-Maturity: + description: Experimental API. Subject to change in the near future. Do not use it in your workflow, scripts, etc. + schema: + type: string + enum: + - experimental + '400': + $ref: '#/components/responses/BadRequest' + '401': + $ref: '#/components/responses/Unauthorized' + '403': + $ref: '#/components/responses/Forbidden' + '404': + $ref: '#/components/responses/NotFound' + '500': + $ref: '#/components/responses/InternalServerError' + '501': + $ref: '#/components/responses/NotImplemented' + /organizations/{provider}/{remoteOrganizationName}/ai-inventory/repositories/summaries/search: + post: + tags: + - aiinventory + summary: List AI inventory repository summaries for an organization + description: | + Returns a paginated list of repository summaries for an organization. + Each summary aggregates resources, references, and AI provider counts for one repository, + with a per-category-group reference breakdown + operationId: searchAiInventoryRepositorySummaries + x-jvm-package: aiInventoryItems + x-codegen-request-body-name: searchAiInventoryRepositorySummariesBody + parameters: + - $ref: '#/components/parameters/providerParam' + - $ref: '#/components/parameters/remoteOrganizationNameParam' + - $ref: '#/components/parameters/cursorParam' + - $ref: '#/components/parameters/limitParam' + requestBody: + description: Filters for AI inventory repository summaries + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/AiInventoryFilter' + responses: + '200': + description: Successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/AiInventoryRepositorySummariesResponse' + headers: + X-Maturity: + description: Experimental API. Subject to change in the near future. Do not use it in your workflow, scripts, etc. + schema: + type: string + enum: + - experimental + '400': + $ref: '#/components/responses/BadRequest' + '401': + $ref: '#/components/responses/Unauthorized' + '403': + $ref: '#/components/responses/Forbidden' + '404': + $ref: '#/components/responses/NotFound' + '500': + $ref: '#/components/responses/InternalServerError' + '501': + $ref: '#/components/responses/NotImplemented' + /organizations/{provider}/{remoteOrganizationName}/ai-inventory/locations/summaries/search: + post: + tags: + - aiinventory + summary: List AI inventory location summaries for an organization + description: | + Returns a paginated list of location summaries for an organization. + Each summary represents a distinct location with an array of regions. + Location is a URI with a couple custom protocols like `repo-file` and `repo-sha`. + operationId: searchAiInventoryLocationSummaries + x-jvm-package: aiInventoryItems + x-codegen-request-body-name: searchAiInventoryLocationSummariesBody + parameters: + - $ref: '#/components/parameters/providerParam' + - $ref: '#/components/parameters/remoteOrganizationNameParam' + - $ref: '#/components/parameters/cursorParam' + - $ref: '#/components/parameters/limitParam' + requestBody: + description: Filters for AI inventory location summaries + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/AiInventoryFilter' + responses: + '200': + description: Successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/AiInventoryLocationSummariesResponse' + headers: + X-Maturity: + description: Experimental API. Subject to change in the near future. Do not use it in your workflow, scripts, etc. + schema: + type: string + enum: + - experimental + '400': + $ref: '#/components/responses/BadRequest' + '401': + $ref: '#/components/responses/Unauthorized' + '403': + $ref: '#/components/responses/Forbidden' + '404': + $ref: '#/components/responses/NotFound' + '500': + $ref: '#/components/responses/InternalServerError' + '501': + $ref: '#/components/responses/NotImplemented' + /organizations/{provider}/{remoteOrganizationName}/ai-inventory/categories/search: + post: + tags: + - aiinventory + summary: List AI inventory categories grouped by category group + description: | + Returns the available inventory categories grouped by their category group. + Used to populate the Categories filter drawer + operationId: searchAiInventoryCategories + x-jvm-package: aiInventoryItems + x-codegen-request-body-name: searchAiInventoryCategoriesBody + parameters: + - $ref: '#/components/parameters/providerParam' + - $ref: '#/components/parameters/remoteOrganizationNameParam' + requestBody: + description: Filters to scope the returned categories + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/AiInventoryFilter' + responses: + '200': + description: Successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/AiInventoryCategoriesResponse' + headers: + X-Maturity: + description: Experimental API. Subject to change in the near future. Do not use it in your workflow, scripts, etc. + schema: + type: string + enum: + - experimental + '400': + $ref: '#/components/responses/BadRequest' + '401': + $ref: '#/components/responses/Unauthorized' + '403': + $ref: '#/components/responses/Forbidden' + '404': + $ref: '#/components/responses/NotFound' + '500': + $ref: '#/components/responses/InternalServerError' + '501': + $ref: '#/components/responses/NotImplemented' +components: + securitySchemes: + ApiKeyAuth: + type: apiKey + description: Learn how to [generate an account API token](https://docs.codacy.com/codacy-api/api-tokens/#account-api-tokens) + name: api-token + in: header + ProjectTokenAuth: + type: apiKey + name: project-token + in: header + description: | + Repository API token. Accepted only by repository-scoped operations that declare it. + Create one with [createRepositoryApiToken](#createrepositoryapitoken) + schemas: + Version: + required: + - data + type: object + properties: + data: + type: string + ProblemLink: + required: + - name + - url + type: object + properties: + name: + type: string + example: Check our documentation + url: + type: string + example: https://docs.codacy.com/faq/troubleshooting/why-isnt-my-public-repository-being-analyzed/ + ApiError: + required: + - actions + - message + type: object + properties: + message: + type: string + innerMessage: + type: string + actions: + type: array + items: + $ref: '#/components/schemas/ProblemLink' + Unauthorized: + allOf: + - $ref: '#/components/schemas/ApiError' + - required: + - code + - error + type: object + properties: + error: + type: string + default: Unauthorized + code: + type: string + default: Unauthorized + UnprocessableEntity: + allOf: + - $ref: '#/components/schemas/ApiError' + - required: + - error + type: object + properties: + error: + type: string + default: UnprocessableEntity + InternalServerError: + allOf: + - $ref: '#/components/schemas/ApiError' + - required: + - error + type: object + properties: + error: + type: string + default: InternalServerError + PaginationInfo: + type: object + properties: + cursor: + type: string description: Cursor to [request the next batch of results](https://docs.codacy.com/codacy-api/using-the-codacy-api/#using-pagination) limit: type: integer @@ -8711,6 +9939,31 @@ components: type: string description: The extent to which this problem affects the repository in terms of analysis execution. example: all_analysis + RepositoryStack: + required: + - commitUuid + - stackTags + - discoveredAt + type: object + properties: + commitUuid: + type: string + description: Commit UUID where the repository stack was discovered. + example: 2f4d2d3f9a7d4e9f8d0fbb4f2f7d2e1b4a5c6d7e + stackTags: + type: array + description: Prefixed stack tags detected for the repository. + example: + - fwk:react + - tool:eslint + items: + type: string + discoveredAt: + type: string + description: Timestamp when the repository stack was discovered. + format: date-time + example: '2026-08-25T15:10:00Z' + x-scala-type: java.time.Instant Branch: required: - branchType @@ -8775,7 +10028,8 @@ components: description: Coding standard identifier and name AddedState: type: string - description: Added state of the repository on Codacy. The possible values are `NotAdded` (the repository wasn't added to Codacy), `Added` (the repository was added to Codacy), or `Following` (the current user is following a repository added to Codacy). + description: | + Added state of the repository on Codacy. Valid values are `NotAdded` (the repository was not added to Codacy), `Added` (the repository was added to Codacy), or `Following` (the current user is following a repository added to Codacy). example: Added enum: - NotAdded @@ -8806,7 +10060,7 @@ components: example: '3' lastUpdated: type: string - description: Timestamp when the repository was last updated, [depending on the Git provider](https://docs.codacy.com/organizations/organization-overview/#last-updated-repositories) + description: Timestamp when the repository was last updated. See [Git provider documentation](https://docs.codacy.com/organizations/organization-overview/#last-updated-repositories) for details. format: date-time example: '2019-05-07T14:29:13.43Z' x-scala-type: java.time.Instant @@ -8825,17 +10079,21 @@ components: - CSS items: type: string + stack: + $ref: '#/components/schemas/RepositoryStack' defaultBranch: $ref: '#/components/schemas/Branch' badges: $ref: '#/components/schemas/Badges' codingStandardId: type: integer - description: '[Deprecated: Use standards field instead] Coding Standard identifier' + description: '**Deprecated:** Use `standards` field instead. Coding standard identifier.' + deprecated: true format: int64 codingStandardName: type: string - description: '[Deprecated: Use standards field instead] Coding Standard name' + description: '**Deprecated:** Use `standards` field instead. Coding standard name.' + deprecated: true standards: type: array description: List of the coding standard identifiers and names @@ -8845,11 +10103,23 @@ components: $ref: '#/components/schemas/AddedState' gatePolicyId: type: integer - description: Identifier of the gate policy the repository is following. If not defined, the repository doesn't follow a gate policy. + description: Identifier of the gate policy the repository is following. If not defined, the repository does not follow a gate policy. format: int64 gatePolicyName: type: string description: Name of the gate policy the repository is following. Present only if the gatePolicyId is defined. + CoverageStatus: + type: string + description: | + Coverage status of the repository's default branch, derived from the stored repository overview. Valid values are `None` (no coverage report has ever been received), `UpToDate` (the most recent commit has a coverage report), `Waiting` (a coverage report is expected but has not arrived yet), or `Stopped` (coverage reports stopped arriving). + example: UpToDate + enum: + - None + - UpToDate + - Waiting + - Stopped + x-ms-enum: + name: CoverageStatus Coverage: type: object properties: @@ -8883,6 +10153,24 @@ components: type: integer format: int32 example: 1 + status: + $ref: '#/components/schemas/CoverageStatus' + lastCommitWithCoverage: + type: string + description: Commit UUID of the most recent commit that received a coverage report. + example: 2f4d2d3f9a7d4e9f8d0fbb4f2f7d2e1b4a5c6d7e + statusUpdatedAt: + type: string + format: date-time + description: Timestamp when `status` last changed. + example: '2026-08-25T15:10:00Z' + x-scala-type: java.time.Instant + valueUpdatedAt: + type: string + format: date-time + description: Timestamp when the coverage value was last updated. + example: '2026-08-25T15:10:00Z' + x-scala-type: java.time.Instant RepositoryQualitySettings: type: object properties: @@ -9153,7 +10441,7 @@ components: default: Conflict SeverityLevel: type: string - description: 'Issue severity level. (These values map to our UI as follows: Info->Minor, Warning->Medium, High->High, Error->Critical)' + description: Issue severity level. These values map to our UI as follows - Info to Minor, Warning to Medium, High to High, Error to Critical. example: Error enum: - Info @@ -9432,53 +10720,366 @@ components: properties: patternId: type: string - description: The pattern's id. - example: ESLint_@typescript-eslint_no-shadow - conflicts: + description: The pattern's id. + example: ESLint_@typescript-eslint_no-shadow + conflicts: + type: array + items: + $ref: '#/components/schemas/StandardParameterConflict' + description: Identifies conflicts in a Pattern + RepositoryToolConflictsResponse: + required: + - data + type: object + properties: + data: + type: array + items: + $ref: '#/components/schemas/StandardPatternConflict' + description: Repository Tool Patterns that have conflicts + AnalysisAction: + type: string + enum: + - clone + - createTasks + - runMetrics + - runPatterns + - createOverviews + x-ms-enum: + name: AnalysisAction + FirstAnalysisOverview: + required: + - action + - complete + type: object + properties: + action: + $ref: '#/components/schemas/AnalysisAction' + complete: + type: boolean + example: false + FirstAnalysisOverviewResponse: + required: + - data + - isStuck + type: object + properties: + data: + type: array + items: + $ref: '#/components/schemas/FirstAnalysisOverview' + isStuck: + type: boolean + description: | + Indicates that the first analysis has been making no observable progress for a long time and likely requires manual intervention. + Clients may surface a retry action when `true` + example: false + AddAutoconfigResponse: + description: A response confirming the autoconfig run was accepted + type: object + properties: + data: + type: object + properties: + analysisId: + description: The autoconfig analysis id that was queued. + type: string + format: uuid + example: 75d1b4cf-ef70-4be8-93ca-e9d21c7dca31 + required: + - analysisId + required: + - data + TooManyRequests: + allOf: + - $ref: '#/components/schemas/ApiError' + - required: + - error + type: object + properties: + error: + type: string + default: TooManyRequests + AutoconfigBeforeAfter: + description: A before/after count pair for a metric impacted by an autoconfig run. + type: object + properties: + before: + description: Value before the run. + type: integer + example: 48 + after: + description: Value after the run. + type: integer + example: 12 + required: + - before + - after + AutoconfigRecommendedPath: + description: A path recommended to be added to the repository ignore list. + type: object + properties: + path: + description: The path to ignore. + type: string + example: src/generated + reason: + description: Reason the path is recommended for ignoring. + type: string + example: Contains only auto-generated files with 312 issues and no manual changes + required: + - path + - reason + AutoconfigToolChange: + description: A tool that was enabled or disabled by an autoconfig run. + type: object + properties: + toolName: + description: Name of the tool. + type: string + example: Spectral + action: + description: Whether the tool was enabled or disabled. + type: string + example: enabled + reason: + description: Reason for the change. + type: string + example: Added for OpenAPI and AsyncAPI linting support + patternsAffected: + description: Number of patterns affected by this tool change. + type: integer + example: 25 + required: + - toolName + - action + - reason + - patternsAffected + AutoconfigParameterChange: + description: A parameter value that changed as part of an autoconfig pattern update. + type: object + properties: + id: + description: Parameter identifier. + type: string + example: threshold + before: + description: Value before the change. + type: string + example: '5' + after: + description: Value after the change. + type: string + example: '10' + required: + - id + - before + - after + AutoconfigPatternChange: + description: A pattern that was enabled, disabled, or updated by an autoconfig run. + type: object + properties: + patternId: + description: Pattern identifier. + type: string + example: Lizard_parameter-count-medium + toolName: + description: Name of the tool the pattern belongs to. + type: string + example: Lizard + action: + description: Whether the pattern was enabled, disabled, or updated. + type: string + example: updated + reason: + description: Reason for the change. + type: string + example: Raised threshold from 5 to 10 to reduce noise in complex Go functions + deltaIssues: + description: Net change in issue count caused by this pattern change. + type: integer + example: -25 + parameters: + description: Parameter values that changed. + type: array + items: + $ref: '#/components/schemas/AutoconfigParameterChange' + required: + - patternId + - toolName + - action + - reason + - deltaIssues + - parameters + AutoconfigConflict: + description: A change skipped due to a conflict with an existing coding standard. + type: object + properties: + patternId: + description: Pattern identifier. + type: string + example: Revive_unused-parameter + toolName: + description: Name of the tool the pattern belongs to. + type: string + example: Revive + conflict: + description: Conflict type. + type: string + example: EnforcedByCodingStandard + codingStandardName: + description: Name of the coding standard that caused the conflict. + type: string + example: Our Default + SOC2 + reason: + description: Explanation of why the change was skipped. + type: string + example: Reports 91 issues but is enforced by a coding standard. + required: + - toolName + - conflict + - reason + AutoconfigRunSummary: + description: Summary of a completed autoconfig run + type: object + properties: + analysisId: + description: The autoconfig analysis ID. + type: string + format: uuid + example: 72aa9244-4281-460a-a4ee-25be58d2a1ab + repositoryId: + description: Repository identifier. + type: integer + format: int64 + example: 456789 + durationMs: + description: Total duration of the run in milliseconds. + type: integer + format: int64 + example: 42000 + issuesBefore: + description: Number of issues found before autoconfig was applied. + type: integer + example: 48 + issuesAfter: + description: Number of issues found after autoconfig was applied. + type: integer + example: 12 + languageCount: + description: Number of languages detected in the repository. + type: integer + example: 3 + fileCount: + description: Number of files analysed. + type: integer + example: 120 + enabledPatterns: + description: Number of patterns enabled before and after this run. + $ref: '#/components/schemas/AutoconfigBeforeAfter' + enabledTools: + description: Number of tools enabled before and after this run. + $ref: '#/components/schemas/AutoconfigBeforeAfter' + issuesByCategory: + description: Issue counts grouped by category, before and after this run. + type: object + additionalProperties: + $ref: '#/components/schemas/AutoconfigBeforeAfter' + issuesBySeverity: + description: Issue counts grouped by severity, before and after this run. + type: object + additionalProperties: + $ref: '#/components/schemas/AutoconfigBeforeAfter' + recommendedPathsToIgnore: + description: Paths recommended to be added to the ignore list. + type: array + items: + $ref: '#/components/schemas/AutoconfigRecommendedPath' + keyImprovements: + description: Human-readable highlights of the most impactful changes made by this run. + type: array + items: + type: string + example: + - Enabled ESLint for JavaScript/TypeScript, reducing 28 issues + - Raised Lizard complexity threshold from 5 to 10 + startedAt: + description: When the run started. + type: string + format: date-time + example: '2024-06-28T14:29:13.43Z' + x-scala-type: java.time.Instant + completedAt: + description: When the run completed. + type: string + format: date-time + example: '2024-06-28T14:29:55.43Z' + x-scala-type: java.time.Instant + toolChanges: + description: Tools that were enabled or disabled by this run. type: array items: - $ref: '#/components/schemas/StandardParameterConflict' - description: Identifies conflicts in a Pattern - RepositoryToolConflictsResponse: - required: - - data - type: object - properties: - data: + $ref: '#/components/schemas/AutoconfigToolChange' + patternChanges: + description: Patterns that were enabled, disabled, or updated by this run. type: array items: - $ref: '#/components/schemas/StandardPatternConflict' - description: Repository Tool Patterns that have conflicts - AnalysisAction: - type: string - enum: - - clone - - createTasks - - runMetrics - - runPatterns - - createOverviews - x-ms-enum: - name: AnalysisAction - FirstAnalysisOverview: + $ref: '#/components/schemas/AutoconfigPatternChange' + conflicts: + description: Changes skipped due to conflicts with existing coding standards. + type: array + items: + $ref: '#/components/schemas/AutoconfigConflict' required: - - action - - complete + - analysisId + - repositoryId + - durationMs + - startedAt + - completedAt + AutoconfigRunSummaryResponse: + description: The latest autoconfig run summary for a repository type: object properties: - action: - $ref: '#/components/schemas/AnalysisAction' - complete: - type: boolean - example: false - FirstAnalysisOverviewResponse: + data: + $ref: '#/components/schemas/AutoconfigRunSummary' required: - data + AutoconfigStatusResponse: + description: The latest autoconfig run status for the repository type: object properties: data: - type: array - items: - $ref: '#/components/schemas/FirstAnalysisOverview' + type: object + properties: + status: + type: string + enum: + - queued + - running + - successful + - failed + description: The current autoconfig analysis status of a repository. + transitionedAt: + description: When the repository transitioned to this status. + type: string + format: date-time + example: '2024-06-28T14:29:13.43Z' + x-scala-type: java.time.Instant + transitionReason: + description: An optional description of why the repository transitioned to the current status. + type: string + example: Timed out. + analysisId: + description: The autoconfig analysis id associated with this status. + type: string + format: uuid + example: 72aa9244-4281-460a-a4ee-25be58d2a1ab + required: + - status + - transitionedAt + - analysisId + required: + - data PullRequestOwner: required: - name @@ -9498,9 +11099,7 @@ components: example: foobar@example.com PullRequest: required: - - commonAncestorCommitSha - gitHref - - headCommitSha - id - number - owner @@ -9605,7 +11204,8 @@ components: description: Name of the quality gate expected: type: number - description: Deprecated, use `expectedThreshold` instead. It is the threshold value configured for the quality gate + description: '**Deprecated:** Use `expectedThreshold` instead. The threshold value configured for the quality gate.' + deprecated: true example: -1 expectedThreshold: $ref: '#/components/schemas/AnalysisExpectedThreshold' @@ -9659,7 +11259,8 @@ components: example: 1 isUpToStandards: type: boolean - description: Deprecated, use PullRequest 'isUpToStandards' (if applicable) instead + description: '**Deprecated:** Use PullRequest `isUpToStandards` instead (if applicable).' + deprecated: true example: true resultReasons: type: array @@ -9964,6 +11565,42 @@ components: format: date-time example: '2019-05-07T14:29:13.43Z' x-scala-type: java.time.Instant + AdvisoryInformation: + description: Enrichment extracted for the associated advisory, such as vulnerable entry-point functions + type: object + required: + - advisoryId + - vulnerableFunctions + properties: + advisoryId: + type: string + description: The advisory identifier + example: CVE-2024-24786 + vulnerableFunctions: + type: array + description: The vulnerable functions of the advisory. + items: + type: string + example: + - Unmarshal + - UnmarshalOptions.Unmarshal + publishedAt: + type: string + format: date-time + x-scala-type: java.time.Instant + description: When the advisory was published, as reported by OSV. + DependencyChains: + type: array + description: | + Dependency chains showing how the vulnerable package is reached. Each chain is an ordered list of package identifiers from the root package down to the vulnerable package. Only present for SCA findings. + items: + type: array + items: + type: string + example: + - - root-app + - lodash + - vulnerable-pkg CommitIssue: required: - fileId @@ -10025,6 +11662,17 @@ components: type: integer description: Threshold for false positive detection format: int32 + advisoryInformation: + $ref: '#/components/schemas/AdvisoryInformation' + dependencyChains: + $ref: '#/components/schemas/DependencyChains' + fixedVersion: + type: array + description: Versions that fix the vulnerable dependency. Empty when no fix is available. Only present for SCA issues. + items: + type: string + example: + - 1.0.1 description: Issue details including the commit that originated the issue DeltaType: type: string @@ -10110,7 +11758,7 @@ components: properties: data: type: array - description: List of duplicate code blocks added or removed in a commit or pull request, or an empty list if Codacy hasn't analyzed the latest commit yet. + description: List of duplicate code blocks added or removed in a commit or pull request, or an empty list if Codacy has not analyzed the latest commit yet. items: $ref: '#/components/schemas/CommitFileClone' pagination: @@ -10158,7 +11806,6 @@ components: data: required: - end - - headCommitSha - start - steps - totalAnalysisTime @@ -10489,7 +12136,7 @@ components: type: string enabled: type: boolean - description: Whether or not this language is to be analyzed for this repository. If left undefined, then the flag will not be updated. + description: Whether this language is to be analyzed for this repository. If left undefined, then the flag will not be updated. RepositoryLanguagesBody: required: - languages @@ -10835,6 +12482,14 @@ components: - ESLint_@typescript-eslint_no-redeclare items: type: string + toolUuids: + type: array + description: Set of tool UUIDs to filter issues by the tools that detected them + example: + - 847feb32-9ff2-11ea-bb37-0242ac130002 + - cf05f3aa-fd23-4586-8cce-5571b1904586 + items: + type: string languages: type: array description: Set of language names, without spaces @@ -10877,6 +12532,12 @@ components: - another@mail.com items: type: string + potentialFalsePositives: + type: boolean + description: | + If true, only issues that are potential false positives will be included in the search, + if false, only issues that are not potential false positives will be included in the search. + example: true description: Search parameters to filter the list of issues in a repository SearchRepositoryIssuesListResponse: required: @@ -10931,6 +12592,7 @@ components: - levels - tags - patterns + - potentialFalsePositives type: object properties: categories: @@ -10963,6 +12625,13 @@ components: description: Number of issues per commit author items: $ref: '#/components/schemas/Count' + potentialFalsePositives: + type: array + description: | + Breakdown of issues by false-positive probability relative to the configured threshold. + Contains two entries named `equalOrAboveThreshold` and `belowThreshold`. + items: + $ref: '#/components/schemas/Count' description: Overview of the issues in a repository IssuesOverview: required: @@ -11008,6 +12677,24 @@ components: type: string description: Optional comment justifying the ignore action description: Ignored status of an issue + SearchRepositoryIgnoredIssuesBody: + description: The body to search ignored issues for a project using filter. + allOf: + - $ref: '#/components/schemas/SearchRepositoryIssuesBody' + - type: object + properties: + ignoreReasons: + type: array + items: + type: string + description: Filter ignored issues by ignore reason. + enum: + - AcceptedUse + - FalsePositive + - NotExploitable + - TestCode + - ExternalCode + example: FalsePositive IgnoredIssue: required: - filePath @@ -11018,6 +12705,7 @@ components: - message - patternInfo - toolInfo + - falsePositiveThreshold type: object properties: issueId: @@ -11193,6 +12881,9 @@ components: zendeskHash: type: string example: userzendeskhash + pylonHash: + type: string + example: userpylonhash shouldDoClientQualification: type: boolean example: false @@ -11246,6 +12937,7 @@ components: - type - hasDastAccess - hasScaEnabled + - imageSbomEnabled type: object properties: identifier: @@ -11278,6 +12970,16 @@ components: type: boolean hasScaEnabled: type: boolean + imageSbomEnabled: + type: boolean + hasAiInventoryEnabled: + type: boolean + hasWebhooksEnabled: + type: boolean + hasFalsePositiveAccess: + type: boolean + hasSilentFalsePositiveDetection: + type: boolean OrganizationListResponse: required: - data @@ -11653,17 +13355,21 @@ components: $ref: '#/components/schemas/PaymentProvider' priceInCents: type: integer - description: Final price paid in cents, containing all taxes if there are any. For example, 12020 represents $120.20. + description: Final price paid in cents, containing all taxes if applicable. For example, 12020 represents $120.20. format: int32 example: 12020 pricePerSeatInCents: type: integer - description: Final price paid per seat in cents, containing all taxes if there are any. For example, 1405 represents $14.05. + description: Final price paid per seat in cents, containing all taxes if applicable. For example, 1405 represents $14.05. format: int32 example: 1405 nextPaymentDate: type: string - description: Next payment date for the plan. This field is empty for plans that don't renew automatically. + description: | + Date the current billing period ends. For a renewing subscription, this is the next payment + date. For a subscription that has been canceled and will not renew, this is the date access + to the plan and its premium features ends. Empty for plans that don't have a billing period, + such as the open-source plan format: date-time example: '2019-05-07T14:29:13.43Z' x-scala-type: java.time.Instant @@ -11879,10 +13585,20 @@ components: description: Toggle the feature "Suggested fixes" (GitHub only) aiEnhancedComments: type: boolean - description: Toggle the feature "AI-enhanced comments". If "Suggested fixes" (GitHub only) is also enabled, then the AI-enhanced comments also provide suggested fixes. This is an experimental feature. + description: | + Toggle the feature "AI-enhanced comments". If "Suggested fixes" (GitHub only) is also enabled, then the AI-enhanced comments also provide suggested fixes. This is an experimental feature. aiPullRequestReviewer: type: boolean - description: Toggle the feature "AI Pull Request Reviewer". When enabled, Codacy will use AI to review pull requests and provide comments on code quality and potential issues. This is an experimental feature. + description: | + Toggle the feature "AI Pull Request Reviewer" (GitHub only). When enabled, Codacy will use AI to review pull requests and provide comments on code quality and potential issues. This is an experimental feature. + aiPullRequestReviewerAutomatic: + type: boolean + description: | + Toggle the feature "AI Pull Request Reviewer Automatic" (GitHub only). When enabled, Codacy will use AI to review pull requests and provide comments on code quality and potential issues automatically once, subsequent reviews will have to be explicitly requested. + pullRequestUnifiedSummary: + type: boolean + description: | + Toggle the feature "Pull Request Unified Summary" (GitHub only). When enabled, Codacy provides a unified summary (coverage and analysis). availableSettings: type: array description: List of available settings for the Git provider integration @@ -11910,10 +13626,20 @@ components: description: Toggle the feature "Suggested fixes" (GitHub only) aiEnhancedComments: type: boolean - description: Toggle the feature "AI-enhanced comments". If "Suggested fixes" (GitHub only) is also enabled, then the AI-enhanced comments also provide suggested fixes. + description: | + Toggle the feature "AI-enhanced comments". If "Suggested fixes" (GitHub only) is also enabled, then the AI-enhanced comments also provide suggested fixes. aiPullRequestReviewer: type: boolean - description: Toggle the feature "AI Pull Request Reviewer". When enabled, Codacy will use AI to review pull requests and provide comments on code quality and potential issues. + description: | + Toggle the feature "AI Pull Request Reviewer" (GitHub only). When enabled, Codacy will use AI to review pull requests and provide comments on code quality and potential issues. + aiPullRequestReviewerAutomatic: + type: boolean + description: | + Toggle the feature "AI Pull Request Reviewer Automatic" (GitHub only). When enabled, Codacy will use AI to review pull requests and provide comments on code quality and potential issues automatically once, subsequent reviews will have to be explicitly requested. + pullRequestUnifiedSummary: + type: boolean + description: | + Toggle the feature "Pull Request Unified Summary" (GitHub only). When enabled, Codacy provides a unified summary (coverage and analysis). description: Default settings for Git provider integrations RepositoryIntegrationSettings: required: @@ -12017,7 +13743,8 @@ components: x-scala-type: java.time.Instant isActive: type: boolean - description: Whether the person is an active committer on Codacy or not. If null, the person isn't a committer, thus they don't occupy a seat. (applies only to specific Enterprise plans) + description: | + Whether the person is an active committer on Codacy or not. If null, the person is not a committer, thus they do not occupy a seat. Applies only to specific Enterprise plans. canBeRemoved: type: boolean description: Whether the person can be removed from the organization or not @@ -12059,7 +13786,8 @@ components: properties: permission: $ref: '#/components/schemas/MembershipPrivileges' - description: Minimum permission level regarding configuring patterns, configuring which file extensions and branches are analyzed, and ignoring issues and files + description: | + Minimum permission level regarding configuring patterns, configuring which file extensions and branches are analyzed, and ignoring issues and files RemovePeopleBody: required: - emails @@ -12098,11 +13826,11 @@ components: properties: contentPermission: type: boolean - description: True if Codacy GitHub App has repository permissions for Contents, false otherwise. + description: True if Codacy GitHub App has repository permissions for Contents, false otherwise example: true customPropertiesPermission: type: boolean - description: True if Codacy GitHub App has permissions for custom properties, false otherwise. + description: True if Codacy GitHub App has permissions for custom properties, false otherwise example: true description: Information about Codacy GitHub App repository permissions ProjectCommitStat: @@ -12281,7 +14009,7 @@ components: example: true message: type: string - example: Since you are the last organization admin of $orgName, to leave this organization you need to delete it. Please, contact us through support. + example: Since you are the last organization admin of $orgName, to leave this organization you need to delete it. Please contact us through support. reason: $ref: '#/components/schemas/LeaveOrgProblem' description: Informs if the user can leave the organization and if not, why. @@ -12430,11 +14158,21 @@ components: format: int64 token: type: string + name: + type: string + example: pt-4f1a9b2c8e3d expiresAt: type: string format: date-time example: '2019-05-07T14:29:13.43Z' x-scala-type: java.time.Instant + createdAt: + type: string + format: date-time + example: '2019-05-07T14:29:13.43Z' + x-scala-type: java.time.Instant + description: | + The timestamp when the token was created. Absent for tokens created before creation dates were recorded description: API token string value and ID ApiTokenListResponse: required: @@ -12484,50 +14222,263 @@ components: - redirectUrl type: object properties: - provider: - $ref: '#/components/schemas/Provider' - redirectUrl: + provider: + $ref: '#/components/schemas/Provider' + redirectUrl: + type: string + ProviderIntegrationListResponse: + required: + - data + type: object + properties: + pagination: + $ref: '#/components/schemas/PaginationInfo' + data: + type: array + items: + $ref: '#/components/schemas/ProviderIntegration' + ConfigurationStatusResponse: + type: object + properties: + statuses: + type: array + items: + type: string + metadata: + required: + - firstSignupDone + type: object + properties: + firstSignupDone: + type: boolean + HealthCheck: + required: + - message + type: object + properties: + message: + type: string + example: Hello, it's me + HealthCheckResponse: + required: + - data + type: object + properties: + data: + $ref: '#/components/schemas/HealthCheck' + AdminEntityIdentification: + type: object + required: + - id + - groupSlug + properties: + id: + type: integer + description: Internal Codacy identifier for this entity + format: int64 + example: 42 + groupSlug: + type: string + description: Name to be used on URLs that identify the group for this type of entity + AdminEntityActionField: + type: object + required: + - name + - displayName + - required + - fieldType + properties: + name: + type: string + description: Field identifier used in the payload + example: cloneSubmodules + displayName: + type: string + description: Human-friendly name for the field + example: Clone Submodules + description: + type: string + description: Description of what the field controls + required: + type: boolean + description: Whether the field is required + fieldType: + type: string + description: The type of the field (boolean, number, string) + example: boolean + currentValueBoolean: + type: boolean + description: Current value if fieldType is boolean + currentValueNumber: + type: integer + format: int64 + description: Current value if fieldType is number + currentValueString: + type: string + description: Current value if fieldType is string + metadata: + type: object + additionalProperties: + type: string + description: Additional metadata for the field + AdminEntityActionMetadata: + type: object + required: + - slug + - displayName + - fields + - requiresConfirmation + properties: + slug: + type: string + description: Unique identifier for the action, used in URLs + example: update-settings + displayName: + type: string + description: Human-friendly name for the action + example: Update Settings + description: + type: string + description: Description of what the action does + fields: + type: array + items: + $ref: '#/components/schemas/AdminEntityActionField' + requiresConfirmation: + type: boolean + description: Whether the action requires user confirmation before execution + AdminEntity: + type: object + required: + - id + - groupSlug + - displayName + - details + - relatedEntities + - availableResources + - availableActions + properties: + id: + type: integer + description: Internal Codacy identifier for this entity + format: int64 + example: 42 + groupSlug: + type: string + description: Name to be used on URLs that identify the group for this type of entity + displayName: + type: string + description: Human friendly name + details: + type: object + additionalProperties: + type: string + example: + provider: GitHub + visibility: private + relatedEntities: + type: array + items: + $ref: '#/components/schemas/AdminEntityIdentification' + availableResources: + type: array + items: + type: string + availableActions: + type: array + items: + $ref: '#/components/schemas/AdminEntityActionMetadata' + AdminEntityGroup: + type: object + required: + - slug + - items + properties: + slug: type: string - ProviderIntegrationListResponse: + description: Name to be used on URLs that identify the group for this type of entity + items: + type: array + items: + $ref: '#/components/schemas/AdminEntity' + AdminEntityGroupResponse: + type: object required: - data - type: object properties: - pagination: - $ref: '#/components/schemas/PaginationInfo' data: type: array items: - $ref: '#/components/schemas/ProviderIntegration' - ConfigurationStatusResponse: + $ref: '#/components/schemas/AdminEntityGroup' + AdminEntityResponse: type: object + required: + - data properties: - statuses: - type: array - items: - type: string - metadata: - required: - - firstSignupDone + data: + $ref: '#/components/schemas/AdminEntity' + NotImplemented: + allOf: + - $ref: '#/components/schemas/ApiError' + - required: + - error type: object properties: - firstSignupDone: - type: boolean - HealthCheck: + error: + type: string + default: NotImplemented + AdminEntityResource: + type: object required: - - message + - details + properties: + details: + type: object + additionalProperties: + type: string + entityIdentification: + $ref: '#/components/schemas/AdminEntityIdentification' + AdminEntityResourcesResponse: type: object + required: + - data properties: - message: + data: + type: array + items: + $ref: '#/components/schemas/AdminEntityResource' + pagination: + $ref: '#/components/schemas/PaginationInfo' + AdminEntityActionPayload: + type: object + additionalProperties: true + description: Action-specific payload with fields matching the action metadata + AdminEntityActionResult: + type: object + required: + - resultType + properties: + resultType: type: string - example: Hello, it's me - HealthCheckResponse: + description: Result type (success, updated, failed) + example: success + changes: + type: object + additionalProperties: + type: string + description: Map of field names to their new values (for updated results) + errorReason: + type: string + description: Error message (for failed results) + entityIdentification: + $ref: '#/components/schemas/AdminEntityIdentification' + AdminEntityActionResponse: + type: object required: - data - type: object properties: data: - $ref: '#/components/schemas/HealthCheck' + $ref: '#/components/schemas/AdminEntityActionResult' License: required: - email @@ -12787,6 +14738,15 @@ components: type: array items: $ref: '#/components/schemas/MetricsTool' + MetricsFilter: + type: object + required: + - metrics + properties: + metrics: + type: array + items: + type: string OrganizationReadyMetrics: required: - organizationId @@ -12859,6 +14819,9 @@ components: value: type: number format: double + latestValue: + type: number + format: double MetricValueResponse: required: - data @@ -12917,6 +14880,8 @@ components: value: type: number format: double + latestValue: + type: number PeriodGroupedMetricValuesResponse: required: - data @@ -12986,6 +14951,8 @@ components: type: string format: date-time x-scala-type: java.time.LocalDate + period: + $ref: '#/components/schemas/PeriodEnum' TimerangeMetricValue: required: - date @@ -13001,6 +14968,9 @@ components: value: type: number format: double + latestValue: + type: number + format: double TimerangeMetricValuesResponse: required: - data @@ -13111,6 +15081,8 @@ components: type: string format: date-time x-scala-type: java.time.LocalDate + period: + $ref: '#/components/schemas/PeriodEnum' FileWithAnalysisInfo: required: - branchId @@ -13203,30 +15175,113 @@ components: $ref: '#/components/schemas/FileWithAnalysisInfo' pagination: $ref: '#/components/schemas/PaginationInfo' - FileMetrics: + DirectoryWithAnalysisInfo: + required: + - path + - name + - nrFiles + - totalIssues + - grade + - gradeLetter type: object properties: - linesOfCode: + path: + type: string + description: Full path of the folder in the repository + example: src/main/scala + name: + type: string + description: Name of the folder, that is the last segment of its path + example: scala + nrFiles: type: integer - description: Lines of code in the file + description: Number of files in the folder, including all subfolders format: int32 - example: 123 - commentedLinesOfCode: + example: 42 + totalIssues: type: integer - description: Commented lines of code in the file - format: int64 - example: 123 - numberOfMethods: + description: Number of issues in the folder, including all subfolders + format: int32 + example: 17 + grade: type: integer - description: Number of methods in the file + description: Quality grade of the folder as a number between 100 (highest grade) and 0 (lowest grade) format: int32 - example: 123 - numberOfClasses: + example: 74 + gradeLetter: + type: string + description: Quality grade of the folder as a letter between A (highest grade) and F (lowest grade) + example: A + complexity: + type: integer + description: Highest complexity of a file in the folder, including all subfolders + format: int32 + example: 12 + complexitySum: + type: integer + description: Total complexity of all files in the folder, including all subfolders + format: int32 + example: 120 + duplication: + type: integer + description: Number of duplicated lines in the folder, including all subfolders + format: int32 + example: 7 + numberOfClones: + type: integer + description: Number of cloned blocks of code in the folder, including all subfolders + format: int32 + example: 5 + coverageWithDecimals: + multipleOf: 0.01 + type: number + description: Test coverage percentage of the folder with decimals + format: double + example: 71 + sourceLinesOfCode: type: integer - description: Number of classes in the file + description: Coverable lines of code in the folder, including all subfolders + format: int32 + example: 90 + linesOfCode: + type: integer + description: Lines of code in the folder, including all subfolders format: int32 example: 123 - description: Metadata for a file + description: Folder with analysis information + DirectoryListResponse: + required: + - data + type: object + properties: + data: + type: array + items: + $ref: '#/components/schemas/DirectoryWithAnalysisInfo' + pagination: + $ref: '#/components/schemas/PaginationInfo' + IgnoredFile: + type: object + required: + - filepath + properties: + filepath: + type: string + IgnoredFileListResponse: + required: + - hasCodacyConfigurationFile + - data + type: object + properties: + hasCodacyConfigurationFile: + type: boolean + description: If the repository has a configuration file that controls what repository files are ignored + data: + type: array + items: + $ref: '#/components/schemas/IgnoredFile' + pagination: + $ref: '#/components/schemas/PaginationInfo' FileCoverageAnalysis: required: - coverableLines @@ -13295,8 +15350,6 @@ components: properties: file: $ref: '#/components/schemas/FileMetadata' - metrics: - $ref: '#/components/schemas/FileMetrics' coverage: $ref: '#/components/schemas/FileCoverageAnalysis' quality: @@ -13799,7 +15852,7 @@ components: properties: data: type: boolean - description: True if the submodules option is enabled for the organization, false otherwise. + description: True if the submodules option is enabled for the organization, false otherwise ListRepositoriesFollowingGatePolicyResultResponse: required: - data @@ -13829,6 +15882,30 @@ components: items: type: string description: Names of the repositories to link or unlink from a gate policy + RepositoryApiTokenCreateRequest: + required: + - name + - expiresAt + type: object + properties: + name: + type: string + pattern: ^[A-Za-z0-9-]{1,100}$ + maxLength: 100 + example: pt-4f1a9b2c8e3d + description: | + A name to identify the token. Must contain only alphanumeric characters and dashes, with a + maximum length of 100 characters. + expiresAt: + type: string + format: date-time + example: '2027-05-07T14:29:13.43Z' + x-scala-type: java.time.Instant + description: | + The timestamp when the token expires. Must be in the future and no more than one year from now. + description: | + Request body for creating a repository API token. When omitted entirely, a name is generated and + the token expires in one year. ApiTokenResponse: required: - data @@ -13836,52 +15913,159 @@ components: properties: data: $ref: '#/components/schemas/ApiToken' + RepositoryApiTokensDeleteRequest: + required: + - ids + type: object + properties: + ids: + type: array + items: + type: integer + format: int64 + description: Ids of the repository API tokens to delete. + description: Request body for deleting repository API tokens by ids CoverageReport: required: - createdAt - - status - - targetCommitSha + - status + - targetCommitSha + type: object + properties: + targetCommitSha: + type: string + description: Commit SHA that was referenced as the target for this report + commit: + $ref: '#/components/schemas/CommitWithBranches' + language: + type: string + description: Programming language associated with the coverage report + createdAt: + type: string + description: Report creation date + format: date-time + x-scala-type: java.time.Instant + status: + type: string + description: Coverage status + enum: + - Pending + - Processed + - CommitNotAnalysed + - CommitNotFound + - BranchNotEnabled + - MissingFinal + description: Status and details of a coverage report + CoverageReportResponse: + required: + - data + type: object + properties: + data: + type: object + properties: + hasCoverageOverview: + type: boolean + description: True if the Quality evolution chart of the repository includes coverage information + lastReports: + type: array + items: + $ref: '#/components/schemas/CoverageReport' + CoverageReportEntry: + required: + - repositoryId + - commitSha + - reportId + - isFinal + - processed + - createdAt + type: object + properties: + repositoryId: + type: integer + format: int64 + commitSha: + type: string + reportId: + type: string + language: + type: string + isFinal: + type: boolean + processed: + type: boolean + createdAt: + type: string + format: date-time + CoverageReportEntryResponse: + required: + - data + type: object + properties: + data: + type: array + items: + $ref: '#/components/schemas/CoverageReportEntry' + pagination: + $ref: '#/components/schemas/PaginationInfo' + CoverageReportFile: + type: object + description: Coverage report for the file + required: + - fileName + - coverage + properties: + fileName: + type: string + description: Name of the file + coverage: + type: object + description: Coverage map + additionalProperties: + type: integer + format: int32 + example: + '1': 2 + '12': 1 + '23': 0 + CoverageReportContent: + required: + - repositoryId + - commitSha + - reportId + - isFinal + - processed + - createdAt + - content type: object properties: - targetCommitSha: + repositoryId: + type: integer + format: int64 + commitSha: + type: string + reportId: type: string - description: Commit SHA that was referenced as the target for this report - commit: - $ref: '#/components/schemas/CommitWithBranches' language: type: string - description: Programming language associated with the coverage report + isFinal: + type: boolean + processed: + type: boolean createdAt: type: string - description: Report creation date format: date-time - x-scala-type: java.time.Instant - status: - type: string - description: Coverage status - enum: - - Pending - - Processed - - CommitNotAnalysed - - CommitNotFound - - BranchNotEnabled - - MissingFinal - description: Status and details of a coverage report - CoverageReportResponse: + content: + type: array + items: + $ref: '#/components/schemas/CoverageReportFile' + CoverageReportContentResponse: required: - data type: object properties: data: - type: object - properties: - hasCoverageOverview: - type: boolean - description: True if the Quality evolution chart of the repository includes coverage information - lastReports: - type: array - items: - $ref: '#/components/schemas/CoverageReport' + $ref: '#/components/schemas/CoverageReportContent' CodeBlockLine: required: - content @@ -13954,6 +16138,15 @@ components: description: Relative path of the file in the repository example: src/main/scala/main/Main.scala description: Ignored status of a file + SrmSource: + type: string + example: Codacy + enum: + - Codacy + - Jira + - PenTest + - ZAP + - Trivy SrmIgnoredBody: required: - at @@ -13999,14 +16192,7 @@ components: format: uuid example: ba7c836d-85f8-4617-9a95-ac6f00af1d30 itemSource: - type: string - description: Source platform of the item's underlying issue - example: Codacy - enum: - - Codacy - - Jira - - PenTest - - ZAP + $ref: '#/components/schemas/SrmSource' itemSourceId: type: string description: Original source item ID. @@ -14080,7 +16266,8 @@ components: example: 0.42 cvssVector: type: string - description: CVSS (Common Vulnerability Scoring System) scoring vector, including various metrics detailing the nature and impact of the vulnerability. Specific to penetration testing issues. + description: | + CVSS (Common Vulnerability Scoring System) scoring vector, including various metrics detailing the nature and impact of the vulnerability. Specific to penetration testing issues. example: CVSS:3.0/AV:A/AC:H/PR:L/UI:R/S:C/C:L/I:L/A:L/E:U/MUI:N cwe: type: string @@ -14088,15 +16275,16 @@ components: example: CWE-122 cve: type: string - description: A list of CVE (Common Vulnerabilities and Exposures) identifiers. Most of the time the array will contain only one single id, but there are niche instances where there can be multiple ones. + description: | + A list of CVE (Common Vulnerabilities and Exposures) identifiers. Most of the time the array will contain only one single ID, but there are niche instances where there can be multiple ones. example: CVE-1970-1234 affectedVersion: type: string - description: Indicating the version when this vulnerability was first detected in your codebase. + description: Indicates the version when this vulnerability was first detected in your codebase example: 1.0.0 fixedVersion: type: array - description: Indicating the version (tag, or commit sha) when this vulnerability was fixed. + description: Indicates the version (tag, or commit SHA) when this vulnerability was fixed items: type: string example: @@ -14107,12 +16295,14 @@ components: example: https://example.com affectedTargets: type: string - description: List of targets affected by the security issue, determined dynamically based on the target type. Includes URLs, app names with operating systems for mobile apps, SSIDs for wireless, hostnames, full names for social engineering targets, and various combinations of hostnames and IP addresses for other targets. Cannot guarantee a specific format. Specific to penetration testing issues. + description: | + List of targets affected by the security issue, determined dynamically based on the target type. Includes URLs, app names with operating systems for mobile apps, SSIDs for wireless, hostnames, full names for social engineering targets, and various combinations of hostnames and IP addresses for other targets. Cannot guarantee a specific format. Specific to penetration testing issues. example: https://example.com additionalInfo: type: string description: Additional information about the issue. - example: 'The following directives either allow wildcard sources (or ancestors), are not defined, or are overly broadly defined: script-src, style-src, img-src, connect-src, frame-src, font-src, media-src, object-src, manifest-src, worker-src, form-action. The directive(s): form-action are among the directives that do not fallback to default-src, missing/excluding them is the same as allowing anything.' + example: | + The following directives either allow wildcard sources (or ancestors), are not defined, or are overly broadly defined: script-src, style-src, img-src, connect-src, frame-src, font-src, media-src, object-src, manifest-src, worker-src, form-action. The directive(s): form-action are among the directives that do not fallback to default-src, missing/excluding them is the same as allowing anything. likelihood: type: string description: Specific to penetration testing issues. @@ -14138,6 +16328,16 @@ components: dastTargetUrls: type: string description: Specifies the target URLs that were scanned. + imageName: + type: string + description: Name of the scanned container image + imageTag: + type: string + description: Tag of the scanned container image + dependencyChains: + $ref: '#/components/schemas/DependencyChains' + advisoryInformation: + $ref: '#/components/schemas/AdvisoryInformation' description: Security and risk management item of an organization. SrmItemsResponse: required: @@ -14172,6 +16372,20 @@ components: data: $ref: '#/components/schemas/SrmItem' description: Response with a security and risk management item. + ContainerImageFilter: + type: object + description: | + Filter for container scanning items. The image `name` is required; + `tag` is optional. Filtering by tag alone (without name) is not allowed. + required: + - name + properties: + name: + type: string + description: Container image name to filter by (e.g. `nginx`). + tag: + type: string + description: Optional image tag (e.g. `1.25.3`). SearchSRMItems: type: object properties: @@ -14182,12 +16396,12 @@ components: type: string priorities: type: array - description: Security issue priorities to filter by. See [SrmPriority](#tocssrmpriority) for possible values. + description: Security issue priorities to filter by. See [SrmPriority](#tocssrmpriority) for valid values. items: type: string statuses: type: array - description: Security issue priorities to filter by. See [SrmStatus](#tocssrmstatus) for possible values. + description: Security issue status to filter by. See [SrmStatus](#tocssrmstatus) for valid values. items: type: string categories: @@ -14226,6 +16440,11 @@ components: description: Filter containing a list of Dast target urls. items: type: string + searchText: + type: string + description: Text to search for in security items. + containerImage: + $ref: '#/components/schemas/ContainerImageFilter' description: Request body to filter the security issues of an organization. SRMDashboard: required: @@ -14357,7 +16576,7 @@ components: type: string priorities: type: array - description: Security issue priorities to filter by. See [SrmPriority](#tocssrmpriority) for possible values. + description: Security issue priorities to filter by. See [SrmPriority](#tocssrmpriority) for valid values. items: type: string enum: @@ -14520,85 +16739,85 @@ components: x-scala-type: java.time.Instant newCritical: type: integer - description: Number of security findings with Critical severity, introduced during the time interval. + description: Number of security findings with Critical severity, introduced during the time interval format: int32 newHigh: type: integer - description: Number of security findings with High severity, introduced during the time interval. + description: Number of security findings with High severity, introduced during the time interval format: int32 newMedium: type: integer - description: Number of security findings with Medium severity, introduced during the time interval. + description: Number of security findings with Medium severity, introduced during the time interval format: int32 newLow: type: integer - description: Number of security findings with Low severity, introduced during the time interval. + description: Number of security findings with Low severity, introduced during the time interval format: int32 fixedCritical: type: integer - description: Number of security findings with Critical severity, fixed during the time interval. + description: Number of security findings with Critical severity, fixed during the time interval format: int32 fixedHigh: type: integer - description: Number of security findings with High severity, fixed during the time interval. + description: Number of security findings with High severity, fixed during the time interval format: int32 fixedMedium: type: integer - description: Number of security findings with Medium severity, fixed during the time interval. + description: Number of security findings with Medium severity, fixed during the time interval format: int32 fixedLow: type: integer - description: Number of security findings with Low severity, fixed during the time interval. + description: Number of security findings with Low severity, fixed during the time interval format: int32 openCritical: type: integer - description: Number of open security findings with Critical severity, at the beginning of the time interval. + description: Number of open security findings with Critical severity, at the beginning of the time interval format: int32 openHigh: type: integer - description: Number of open security findings with High severity, at the beginning of the time interval. + description: Number of open security findings with High severity, at the beginning of the time interval format: int32 openMedium: type: integer - description: Number of open security findings with Medium severity, at the beginning of the time interval. + description: Number of open security findings with Medium severity, at the beginning of the time interval format: int32 openLow: type: integer - description: Number of open security findings with Low severity, at the beginning of the time interval. + description: Number of open security findings with Low severity, at the beginning of the time interval format: int32 ignoredCritical: type: integer - description: Number of ignored security findings with Critical severity, at the beginning of the time interval. + description: Number of ignored security findings with Critical severity, at the beginning of the time interval format: int32 ignoredHigh: type: integer - description: Number of ignored security findings with High severity, at the beginning of the time interval. + description: Number of ignored security findings with High severity, at the beginning of the time interval format: int32 ignoredMedium: type: integer - description: Number of ignored security findings with Medium severity, at the beginning of the time interval. + description: Number of ignored security findings with Medium severity, at the beginning of the time interval format: int32 ignoredLow: type: integer - description: Number of ignored security findings with Low severity, at the beginning of the time interval. + description: Number of ignored security findings with Low severity, at the beginning of the time interval format: int32 unignoredCritical: type: integer - description: Number of unignored security findings with Critical severity, at the beginning of the time interval. + description: Number of unignored security findings with Critical severity, at the beginning of the time interval format: int32 unignoredHigh: type: integer - description: Number of unignored security findings with High severity, at the beginning of the time interval. + description: Number of unignored security findings with High severity, at the beginning of the time interval format: int32 unignoredMedium: type: integer - description: Number of unignored security findings with Medium severity, at the beginning of the time interval. + description: Number of unignored security findings with Medium severity, at the beginning of the time interval format: int32 unignoredLow: type: integer - description: Number of unignored security findings with Low severity, at the beginning of the time interval. + description: Number of unignored security findings with Low severity, at the beginning of the time interval format: int32 - description: Totals for open, new and fixed security findings during the given time interval. + description: Totals for open, new, and fixed security findings during the given time interval SRMDashboardHistoryResponse: required: - data @@ -14809,9 +17028,60 @@ components: type: string example: Cryptography description: List of security categories that have security issues. + FindingSeverity: + type: string + description: Finding severity level. Possible values are `Critical`, `High`, `Medium`, `Low`. + example: Critical + enum: + - Critical + - High + - Medium + - Low + x-ms-enum: + name: FindingSeverity + LicenseRiskCategory: + type: string + description: The risk category of a license. + enum: + - Forbidden + - Restricted + - Reciprocal + - Notice + - Permissive + - Unencumbered + - Unknown SearchSbomDependenciesBody: type: object description: Request body for searching dependencies. + properties: + text: + type: string + description: Text search query. Matches against SBOM component fields (purl, full_name). + repositories: + type: array + description: Repository names to filter by. + items: + type: string + segments: + type: array + description: Segments ids to filter by. + example: + - 1 + - 2 + - 3 + items: + type: integer + format: int64 + findingSeverities: + type: array + description: Finding severities to filter by. Possible values are `Critical`, `High`, `Medium`, `Low`. + items: + $ref: '#/components/schemas/FindingSeverity' + riskCategories: + type: array + description: License Risk categories to filter by. + items: + $ref: '#/components/schemas/LicenseRiskCategory' OpenFindingsCount: required: - open @@ -14826,17 +17096,6 @@ components: description: The number of open findings. format: int32 description: The open findings count for a given severity. - LicenseRiskCategory: - type: string - description: The risk category of a license. - enum: - - Forbidden - - Restricted - - Reciprocal - - Notice - - Permissive - - Unencumbered - - Unknown LicensesDetails: type: object description: Detailed information about a license. @@ -14892,7 +17151,7 @@ components: format: int32 findings: type: array - description: An array containing the open findings count, per severity, found for this dependency. + description: An array containing the open findings count, per severity, found for this dependency items: $ref: '#/components/schemas/OpenFindingsCount' licensesDetails: @@ -14919,11 +17178,13 @@ components: format: int32 totalDependenciesCount: type: integer - description: The total number of dependencies found across repositories for which there is dependency information. If the same dependency is used in multiple repositories, it will be counted multiple times. This number does not change with filtering. + description: | + The total number of dependencies found across repositories for which there is dependency information. If the same dependency is used in multiple repositories, it will be counted multiple times. This number does not change with filtering. format: int64 filteredDependenciesCount: type: integer - description: The total number of filtered dependencies found across repositories for which there is dependency information. If the same dependency is used in multiple repositories, it will be counted multiple times. This number does not change with filtering. + description: | + The total number of filtered dependencies found across repositories for which there is dependency information. If the same dependency is used in multiple repositories, it will be counted multiple times. format: int64 description: Overview of a search dependencies request. SearchSbomDependenciesResponse: @@ -14942,16 +17203,6 @@ components: overview: $ref: '#/components/schemas/SbomDependenciesOverview' description: Response body for searching dependencies. - NotImplemented: - allOf: - - $ref: '#/components/schemas/ApiError' - - required: - - error - type: object - properties: - error: - type: string - default: NotImplemented SearchRepositoriesOfSbomDependencyBody: type: object required: @@ -14960,7 +17211,12 @@ components: properties: dependencyFullName: type: string - description: the full name of the dependency to search for + description: The full name of the dependency to search for. + repositoriesFilter: + type: array + description: Repository names to filter by. + items: + type: string RepositorySummaryOfSbomDependency: required: - id @@ -15089,11 +17345,11 @@ components: dependenciesCount: minimum: 0 type: integer - description: The number of dependencies this repository has, including indirect dependencies. + description: The number of dependencies this repository has, including indirect dependencies format: int32 dependenciesFindings: type: array - description: An array containing the open findings count, per severity, found for this repository's dependencies. + description: An array containing the open findings count, per severity, found for this repository's dependencies items: $ref: '#/components/schemas/OpenFindingsCount' description: Summary of the dependencies of a repository. @@ -15115,11 +17371,13 @@ components: format: int32 totalDependenciesCount: type: integer - description: The total number of dependencies found across repositories for which there is dependency information. If the same dependency is used in multiple repositories, it will be counted multiple times. This number does not change with filtering. + description: | + The total number of dependencies found across repositories for which there is dependency information. If the same dependency is used in multiple repositories, it will be counted multiple times. This number does not change with filtering. format: int64 filteredDependenciesCount: type: integer - description: The total number of filtered dependencies found across repositories for which there is dependency information. If the same dependency is used in multiple repositories, it will be counted multiple times. This number does not change with filtering. + description: | + The total number of filtered dependencies found across repositories for which there is dependency information. If the same dependency is used in multiple repositories, it will be counted multiple times. format: int64 description: Overview of dependencies used across repositories. SearchSbomRepositoriesResponse: @@ -15148,6 +17406,126 @@ components: description: Presigned S3 URL to download the SBOM JSON. required: - url + ImageSummary: + type: object + properties: + imageName: + type: string + description: The name of the Docker image + example: codacy/service-a + latestTag: + type: string + description: The most recently uploaded tag for this image + example: 1.0.0 + lastSbomUploaded: + type: string + format: date-time + description: Timestamp when the last SBOM was uploaded + x-scala-type: java.time.Instant + lastSbomGenerated: + type: string + format: date-time + description: Timestamp when the last SBOM was generated + x-scala-type: java.time.Instant + tagCount: + type: integer + format: int32 + description: Number of tags uploaded for this image + example: 12 + required: + - imageName + - tagCount + ImagesUsage: + type: object + properties: + imageTags: + type: integer + format: int32 + description: Number of image tags uploaded across the organization, counted against the limit + example: 750 + limit: + type: integer + format: int32 + description: Maximum number of image tags allowed for the organization + example: 1000 + required: + - imageTags + - limit + ListImagesResponse: + type: object + properties: + pagination: + $ref: '#/components/schemas/PaginationInfo' + data: + type: array + items: + $ref: '#/components/schemas/ImageSummary' + usage: + $ref: '#/components/schemas/ImagesUsage' + required: + - pagination + - data + - usage + ImageTagSummary: + type: object + properties: + imageName: + type: string + description: The name of the Docker image + example: codacy/service-a + tag: + type: string + description: Tag of the Docker image + environment: + type: string + description: Environment where the image is deployed + repositoryId: + type: integer + format: int64 + description: The repository id associated with this image tag + repositoryName: + type: string + description: The repository name associated with this image tag + generatedAt: + type: string + format: date-time + description: The timestamp when the SBOM for this image tag was generated + x-scala-type: java.time.Instant + uploadedAt: + type: string + format: date-time + description: The timestamp when the SBOM was uploaded to the system + x-scala-type: java.time.Instant + scanStatus: + type: string + deprecated: true + format: date-time + description: | + **Deprecated:** Use `lastAnalysedAt` instead. + The timestamp when this image tag was last analysed. + x-scala-type: java.time.Instant + lastAnalysedAt: + type: string + format: date-time + description: The timestamp when this image tag was last analysed + x-scala-type: java.time.Instant + required: + - imageName + - tag + - generatedAt + - uploadedAt + ListImageTagsResponse: + type: object + properties: + pagination: + $ref: '#/components/schemas/PaginationInfo' + data: + type: array + items: + $ref: '#/components/schemas/ImageTagSummary' + required: + - pagination + - data ElementType: type: string enum: @@ -15477,9 +17855,93 @@ components: webhook_url: pattern: https:\/\/hooks\.slack\.com\/services\/T[a-zA-Z0-9_]{8,10}\/B[a-zA-Z0-9_]{8,10}\/[a-zA-Z0-9_]{24} type: string - description: Slack Incoming Webhook URL to post notifications to. - example: https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX - description: The request body to create or update the Slack integration of the organization. + description: Slack Incoming Webhook URL to post notifications to. + example: https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX + description: The request body to create or update the Slack integration of the organization. + WebhookEndpoint: + required: + - id + - url + - createdAt + type: object + properties: + id: + type: string + format: uuid + description: Identifier of the webhook endpoint + example: 80f64371-e6bc-4d9b-b022-7c873cc5e39f + url: + type: string + format: uri + description: HTTPS URL that receives webhook deliveries + example: https://example.com/webhooks/codacy + createdAt: + type: string + format: date-time + example: '2020-11-09T09:10:00Z' + x-scala-type: java.time.Instant + description: A webhook endpoint configured for the organization + WebhookEndpointList: + required: + - data + - count + - limit + type: object + properties: + data: + type: array + items: + $ref: '#/components/schemas/WebhookEndpoint' + count: + type: integer + format: int32 + description: Number of webhook endpoints configured for the organization + example: 2 + limit: + type: integer + format: int32 + description: Maximum number of webhook endpoints allowed per organization + example: 10 + description: A list of webhook endpoints configured for the organization + CreateWebhookEndpointBody: + required: + - url + type: object + properties: + url: + type: string + format: uri + description: HTTPS URL to receive webhook deliveries. Must use the `https` scheme + example: https://example.com/webhooks/codacy + description: The request body to create a webhook endpoint for the organization + WebhookEndpointCreated: + required: + - id + - url + - createdAt + - secret + type: object + properties: + id: + type: string + format: uuid + description: Identifier of the webhook endpoint + example: 80f64371-e6bc-4d9b-b022-7c873cc5e39f + url: + type: string + format: uri + description: HTTPS URL that receives webhook deliveries + example: https://example.com/webhooks/codacy + createdAt: + type: string + format: date-time + example: '2020-11-09T09:10:00Z' + x-scala-type: java.time.Instant + secret: + type: string + description: Signing secret for this webhook endpoint. Shown only once, at creation time + example: 3n8fVhZ2k9m1QpXeYtR7wLdCsUbGjNoA + description: A newly created webhook endpoint, including its one-time signing secret DiffResponse: required: - diff @@ -15489,6 +17951,79 @@ components: type: string example: diff --git a/example.md b/example.md\nindex 9eeb703..777b981 100644\n--- a/example.md\n+++ b/example.md\n@@ -1 +1 @@\n-Edited line\n+Edited line (edit)\n description: Human-readable Git diff of a commit or pull request, matching the output format of the [`git diff` command](https://git-scm.com/docs/git-diff) + SrmPriority: + type: string + example: Critical + enum: + - Low + - Medium + - High + - Critical + SrmStatus: + type: string + example: Overdue + enum: + - Overdue + - OnTrack + - DueSoon + - ClosedOnTime + - ClosedLate + - Ignored + PostReportSecurityItemsBody: + type: object + description: Optional filters for exporting security items as CSV + properties: + repositories: + type: array + description: Repository names to filter by + items: + type: string + priorities: + type: array + description: Security issue priorities to filter by. See [SrmPriority](#tocssrmpriority) for valid values. + items: + $ref: '#/components/schemas/SrmPriority' + statuses: + type: array + description: Security issue status to filter by. See [SrmStatus](#tocssrmstatus) for valid values. + items: + $ref: '#/components/schemas/SrmStatus' + categories: + type: array + description: | + Security categories to filter by. Use `_other_` to search for + issues that don't have a security category + items: + type: string + scanTypes: + type: array + description: Scan types to filter by + example: + - SAST + - SCA + - ContainerSCA + - Secrets + - IaC + - CICD + - License + - PenTesting + - DAST + - CSPM + items: + type: string + segments: + type: array + description: Segment IDs to filter by + example: + - 1 + - 2 + - 3 + items: + type: integer + format: int64 + searchText: + type: string + description: Text to search for in security items CommitDetails: required: - commit @@ -15649,7 +18184,7 @@ components: example: UI repositoryName: type: string - description: Name of the repository, if the scope of the event action is a repository. + description: Name of the repository, if the scope of the event action is a repository example: '' description: type: string @@ -15658,11 +18193,13 @@ components: details: type: object properties: {} - description: Details specific to the performed event action. Includes the JSON-format body of the performed request, and any additional information related to that action. - example: '{"link":["repo-one","unlink":[]}' + description: | + Details specific to the performed event action. Includes the JSON-format body of the performed request, and any additional information related to that action. + example: '{"link":["repo-one"],"unlink":[]}' entityId: type: string - description: Identifier of the entity involved in the event. For example, the identifier of the updated gate policy in an event with the action `organizations.gatepolicies.update`. + description: | + Identifier of the entity involved in the event. For example, the identifier of the updated gate policy in an event with the action `organizations.gatepolicies.update`. example: '123456' description: Audit log of an event performed by a Codacy user who is part of an organization. SegmentsSyncStatusResponse: @@ -15672,7 +18209,7 @@ components: properties: status: type: string - description: Status of the segments synchronization process. Can be "Syncing", "Completed", "Error", "NotSynced". + description: Status of the segments synchronization process. Valid values are `Syncing`, `Completed`, `Error`, `NotSynced`. example: Syncing error: type: string @@ -15912,16 +18449,6 @@ components: - analysisId required: - data - TooManyRequests: - allOf: - - $ref: '#/components/schemas/ApiError' - - required: - - error - type: object - properties: - error: - type: string - default: TooManyRequests SLAConfig: type: object description: SLA configuration of an organization. @@ -16186,68 +18713,431 @@ components: properties: name: type: string - description: The name of the check. - score: - type: number - format: float - description: The score of the check. - reason: + description: The name of the check. + score: + type: number + format: float + description: The score of the check. + reason: + type: string + description: The reason for the score. + details: + type: array + items: + type: string + description: The details of the check. + documentation: + $ref: '#/components/schemas/OssfScorecardDocumentation' + severity: + $ref: '#/components/schemas/OssfScorecardSeverity' + required: + - name + - score + - reason + - details + - documentation + - severity + OssfScorecard: + type: object + description: OSSF Scorecard information for a repository. + properties: + score: + type: number + format: float + description: The overall OSSF Scorecard score. + date: + type: string + description: The date of the scorecard. + checks: + type: array + description: The list of OSSF Scorecard checks. + items: + $ref: '#/components/schemas/OssfScorecardCheck' + failingCheckCount: + type: integer + format: int32 + description: The number of failing checks. + passingCheckCount: + type: integer + format: int32 + description: The number of passing checks. + required: + - score + - checks + - date + - failingCheckCount + - passingCheckCount + OssfScorecardResponse: + type: object + description: Response body to fetch OSSF Scorecard information. + properties: + data: + $ref: '#/components/schemas/OssfScorecard' + required: + - data + AiInventoryFilter: + type: object + description: Common filters for AI inventory queries + properties: + inventoryItemTypes: + type: array + description: Inventory item types to filter by (e.g. `tool`, `asset`) + items: + type: string + example: + - tool + aiProvider: + type: string + description: AI provider name to filter by + example: Claude Code + segments: + type: array + description: Segment IDs to filter by + items: + type: integer + format: int64 + example: + - 1 + - 2 + - 3 + repositories: + type: array + description: Repository names to filter by + items: + type: string + categoryGroups: + type: array + description: | + Inventory category groups to filter by (e.g. `workflows`, `usage`, `mcps`). + Category groups are the higher-level buckets that group individual categories + items: + type: string + example: + - usage + categories: + type: array + description: | + Inventory categories to filter by (e.g. `code_marker`, `commits`, `branches`, `settings`, `instructions`). + Available categories grouped by category group can be retrieved from the categories endpoint + items: + type: string + example: + - code_marker + marker: + type: string + description: | + Marker text to filter by. Typically used when drilling down from a marker summary + to list its repositories or locations + example: Generated with [Claude Code] + CategoryGroupCount: + type: object + description: Counts for a given categoryGroup + required: + - categoryGroup + - count + properties: + categoryGroup: + type: string + description: Inventory category group (e.g. `workflows`, `usage`, `mcps`) + example: usage + repositoriesCount: + type: integer + format: int32 + description: Number of distinct repositories with items in this category group + example: 12 + count: + type: integer + format: int32 + description: Number of distinct (category, marker) pairs in this category group + example: 4 + AiInventoryProviderSummary: + type: object + description: | + Summary of AI inventory for a provider. `resources` are distinct + (`categoryGroup`, `category`, `marker`) groupings; `references` are individual + inventory item findings; `repositories` are the distinct repositories where they occur + required: + - aiProvider + - resourcesCount + - referencesCount + - repositoriesCount + - categoryGroupBreakdown + properties: + aiProvider: + type: string + description: AI provider name + example: Claude Code + resourcesCount: + type: integer + format: int32 + description: | + Number of distinct inventory resources for this provider. + A resource is a (`categoryGroup`, `category`, `marker`) grouping + example: 12 + referencesCount: + type: integer + format: int32 + description: Total number of inventory item references (individual findings) for this provider + example: 120 + repositoriesCount: + type: integer + format: int32 + description: Number of distinct repositories where items for this provider occur + example: 12 + categoryGroupBreakdown: + type: array + items: + $ref: '#/components/schemas/CategoryGroupCount' + description: | + Per-category-group repository counts (e.g. how many repositories have + `workflows` items, how many have `usage` items) + AiInventoryProviderSummariesResponse: + type: object + required: + - data + - pagination + properties: + data: + type: array + items: + $ref: '#/components/schemas/AiInventoryProviderSummary' + pagination: + $ref: '#/components/schemas/PaginationInfo' + GetAiInventoryProviderSummaryBody: + type: object + description: | + Required AI provider identity plus optional filters to scope the returned summary counts. + The caller must name the provider to summarize + required: + - aiProvider + properties: + aiProvider: + type: string + description: AI provider name to return the summary for + example: Claude Code + inventoryItemTypes: + type: array + description: Inventory item types to filter by (e.g. `tool`, `asset`) + items: + type: string + example: + - tool + segments: + type: array + description: Segment IDs to filter by + items: + type: integer + format: int64 + example: + - 1 + - 2 + - 3 + repositories: + type: array + description: Repository names to filter by + items: + type: string + categoryGroups: + type: array + description: | + Inventory category groups to filter by (e.g. `workflows`, `usage`, `mcps`). + Category groups are the higher-level buckets that group individual categories + items: + type: string + example: + - usage + categories: + type: array + description: | + Inventory categories to filter by (e.g. `code_marker`, `commits`, `branches`, `settings`, `instructions`). + Available categories grouped by category group can be retrieved from the categories endpoint + items: + type: string + example: + - code_marker + AiInventoryProviderSummaryResponse: + type: object + required: + - data + properties: + data: + $ref: '#/components/schemas/AiInventoryProviderSummary' + AiInventoryMarkerSummary: + type: object + description: | + Summary for a distinct inventory resource — a (`categoryGroup`, `category`, `marker`) grouping. + `references` are the individual findings across repositories for this grouping; + `repositories` are the distinct repositories containing them + required: + - categoryGroup + - category + - marker + - referencesCount + - repositoriesCount + properties: + categoryGroup: + type: string + description: Category group the marker belongs to (e.g. `usage`, `workflows`, `mcps`) + example: usage + category: type: string - description: The reason for the score. - details: + description: Category the marker belongs to within its category group (e.g. `code_marker`, `commits`) + example: code_marker + marker: + type: string + description: | + Marker text identifying the inventory item (e.g. a generated-by string, + a package name, a model ID) + example: Generated with [Claude Code] + referencesCount: + type: integer + format: int32 + description: Total number of references (individual findings) for this marker + example: 4 + repositoriesCount: + type: integer + format: int32 + description: Number of distinct repositories containing this marker + example: 3 + AiInventoryMarkerSummariesResponse: + type: object + required: + - data + - pagination + properties: + data: type: array items: - type: string - description: The details of the check. - documentation: - $ref: '#/components/schemas/OssfScorecardDocumentation' - severity: - $ref: '#/components/schemas/OssfScorecardSeverity' + $ref: '#/components/schemas/AiInventoryMarkerSummary' + pagination: + $ref: '#/components/schemas/PaginationInfo' + AiInventoryRepositoryInfo: + type: object + description: A repository that has AI inventory items required: - name - - score - - reason - - details - - documentation - - severity - OssfScorecard: - type: object - description: OSSF Scorecard information for a repository. + - owner properties: - score: - type: number - format: float - description: The overall OSSF Scorecard score. - date: + name: type: string - description: The date of the scorecard. - checks: + description: Name of the repository + example: codacy-website + owner: + type: string + description: Owner of the repository + example: codacy + AiInventoryRepositoryListResponse: + type: object + required: + - data + - pagination + properties: + data: type: array - description: The list of OSSF Scorecard checks. items: - $ref: '#/components/schemas/OssfScorecardCheck' - failingCheckCount: + $ref: '#/components/schemas/AiInventoryRepositoryInfo' + pagination: + $ref: '#/components/schemas/PaginationInfo' + AiInventoryRepositorySummary: + type: object + description: | + Summary of AI inventory for a repository. + `locations` are the distinct locations containing matching inventory items; + `references` are the individual findings across those locations + required: + - repositoryName + - locationsCount + - referencesCount + properties: + repositoryName: + type: string + description: Name of the repository + example: my-service + locationsCount: type: integer format: int32 - description: The number of failing checks. - passingCheckCount: + description: Number of distinct locations in this repository containing matching inventory items + example: 11 + referencesCount: type: integer format: int32 - description: The number of passing checks. + description: Total number of inventory item references in this repository + example: 11 + AiInventoryRepositorySummariesResponse: + type: object required: - - score - - checks - - date - - failingCheckCount - - passingCheckCount - OssfScorecardResponse: + - data + - pagination + properties: + data: + type: array + items: + $ref: '#/components/schemas/AiInventoryRepositorySummary' + pagination: + $ref: '#/components/schemas/PaginationInfo' + AiInventoryLocationSummary: type: object - description: Response body to fetch OSSF Scorecard information. + description: | + Summary for a distinct location, describing where an AI inventory item is referenced. + The caller scopes which items are included via the request filter + required: + - location + - regions + properties: + location: + type: string + description: Location URI (e.g. `repo-file:src/somefile.py`, `repo-sha:abc123`) + example: repo-file:src/ai/client.py + regions: + type: array + description: | + Regions within the location relevant to the inventory item. + Each region is a URI with its own kind prefix (e.g. `line:10`). + May be empty when the item has no region-level granularity + items: + type: string + example: line:10 + AiInventoryLocationSummariesResponse: + type: object + required: + - data + - pagination properties: data: - $ref: '#/components/schemas/OssfScorecard' + type: array + items: + $ref: '#/components/schemas/AiInventoryLocationSummary' + pagination: + $ref: '#/components/schemas/PaginationInfo' + AiInventoryCategoryGroup: + type: object + description: A category group with its child categories + required: + - categoryGroup + - categories + properties: + categoryGroup: + type: string + description: Category group name (e.g. `workflows`, `usage`, `mcps`) + example: usage + categories: + type: array + description: Categories belonging to this group + items: + type: string + example: + - code_marker + - commits + - branches + AiInventoryCategoriesResponse: + type: object required: - data + properties: + data: + type: array + items: + $ref: '#/components/schemas/AiInventoryCategoryGroup' responses: Unauthorized: description: Unauthorized @@ -16305,6 +19195,13 @@ components: schema: $ref: '#/components/schemas/Forbidden' x-ms-error-response: true + TooManyRequests: + description: Too Many Requests + content: + application/json: + schema: + $ref: '#/components/schemas/TooManyRequests' + x-ms-error-response: true MethodNotAllowed: description: Method Not Allowed content: @@ -16319,13 +19216,6 @@ components: schema: $ref: '#/components/schemas/PaymentRequired' x-ms-error-response: true - PayloadTooLarge: - description: Content too large - content: - application/json: - schema: - $ref: '#/components/schemas/PayloadTooLarge' - x-ms-error-response: true NotImplemented: description: Not Implemented content: @@ -16333,18 +19223,18 @@ components: schema: $ref: '#/components/schemas/NotImplemented' x-ms-error-response: true - TooManyRequests: - description: Too Many Requests + PayloadTooLarge: + description: Content too large content: application/json: schema: - $ref: '#/components/schemas/TooManyRequests' + $ref: '#/components/schemas/PayloadTooLarge' x-ms-error-response: true parameters: providerParam: name: provider in: path - description: Git provider + description: Git provider identifier (e.g., gh for GitHub, gl for GitLab, bb for Bitbucket) required: true schema: type: string @@ -16386,7 +19276,7 @@ components: searchParam: name: search in: query - description: Filter the results searching by this string. + description: Filter results by searching for this string schema: type: string x-ms-parameter-location: method @@ -16395,7 +19285,8 @@ components: repositoriesParam: name: repositories in: query - description: Deprecated, use [SearchOrganizationRepositoriesWithAnalysis](#searchorganizationrepositorieswithanalysis) instead + description: '**Deprecated:** Use [searchOrganizationRepositoriesWithAnalysis](#searchorganizationrepositorieswithanalysis) instead.' + deprecated: true schema: type: string x-ms-parameter-location: method @@ -16404,7 +19295,7 @@ components: segmentsParam: name: segments in: query - description: Filter by a comma separated list of segment ids. + description: Filter by a comma-separated list of segment identifiers schema: type: string x-ms-parameter-location: method @@ -16435,7 +19326,7 @@ components: toolUuidParam: name: toolUuid in: path - description: Tool unique identifier + description: Unique identifier (UUID) for the tool required: true schema: type: string @@ -16445,7 +19336,7 @@ components: languagesFilterParam: name: languages in: query - description: Languages filter + description: Comma-separated list of programming languages to filter results by schema: type: string x-ms-parameter-location: method @@ -16454,7 +19345,8 @@ components: categoriesParam: name: categories in: query - description: Filter by a comma separated list of code pattern categories. The allowed values are 'Security', 'ErrorProne', 'CodeStyle', 'Compatibility', 'UnusedCode', and 'Performance' + description: | + Filter by a comma-separated list of code pattern categories. Valid values are `Security`, `ErrorProne`, `CodeStyle`, `Compatibility`, `UnusedCode`, `Complexity`, `Comprehensibility`, `Documentation`, `BestPractice`, and `Performance`. schema: type: string x-ms-parameter-location: method @@ -16463,7 +19355,7 @@ components: severityLevelsParam: name: severityLevels in: query - description: Filter by a comma separated list of code pattern severity levels. The allowed values are 'Error', 'High', 'Warning', and 'Info' + description: Filter by a comma-separated list of code pattern severity levels. Valid values are `Error`, `High`, `Warning`, and `Info`. schema: type: string x-ms-parameter-location: method @@ -16472,7 +19364,7 @@ components: tagsParam: name: tags in: query - description: Filter by a comma separated list of pattern tags + description: Filter by a comma-separated list of pattern tags schema: type: string x-ms-parameter-location: method @@ -16481,7 +19373,7 @@ components: enabledPatternParam: name: enabled in: query - description: Returns only the enabled or disabled patterns. + description: Filter by pattern status. Set to `true` to return only enabled patterns, or `false` to return only disabled patterns schema: type: boolean x-ms-parameter-location: method @@ -16489,7 +19381,15 @@ components: recommendedPatternParam: name: recommended in: query - description: Returns only the recommended or non-recommended patterns. + description: Filter by recommended status. Set to `true` to return only recommended patterns, or `false` to return only non-recommended patterns + schema: + type: boolean + x-ms-parameter-location: method + x-ms-parameter-location: method + matchesStackParam: + name: matchesStack + in: query + description: Filter repository code patterns by whether they match the repository stack. schema: type: boolean x-ms-parameter-location: method @@ -16497,7 +19397,7 @@ components: patternsSortParam: name: sort in: query - description: Field used to sort the tool's code patterns. The allowed values are 'category', 'recommended', and 'severity' + description: Field used to sort the tool's code patterns. Valid values are `category`, `recommended`, and `severity`. schema: type: string x-ms-parameter-location: method @@ -16522,6 +19422,29 @@ components: x-ms-parameter-location: method example: ScalaStyle_BlockImportChecker x-ms-parameter-location: method + textQueryParam: + name: textQuery + in: query + description: | + Filter pull requests by a free-text search matched, case-insensitively, against the + pull request title or the author's handle. + schema: + type: string + x-ms-parameter-location: method + example: fix flaky test + x-ms-parameter-location: method + targetBranchParam: + name: targetBranch + in: query + description: | + Filter pull requests by the name of their target branch. + Pull requests targeting any other branch are excluded from the results. + By default, pull requests targeting any branch are returned. + schema: + type: string + x-ms-parameter-location: method + example: main + x-ms-parameter-location: method pullRequestNumberParam: name: pullRequestNumber in: path @@ -16533,10 +19456,20 @@ components: x-ms-parameter-location: method example: 738490 x-ms-parameter-location: method + commitUuid: + name: commitUuid + in: path + description: UUID or SHA string that identifies the commit + required: true + schema: + type: string + x-ms-parameter-location: method + example: 2957025d42e8daadf937d4044516f991d21deea4 + x-ms-parameter-location: method issueStatusParam: name: status in: query - description: Issue status + description: Filter issues by status. Valid values are `all`, `new`, or `fixed`. schema: type: string enum: @@ -16553,7 +19486,7 @@ components: onlyPotentialParam: name: onlyPotential in: query - description: If true, retrieves only potential issues + description: Set to `true` to return only potential issues schema: type: boolean x-ms-parameter-location: method @@ -16566,16 +19499,6 @@ components: required: true schema: type: string - commitUuid: - name: commitUuid - in: path - description: UUID or SHA string that identifies the commit - required: true - schema: - type: string - x-ms-parameter-location: method - example: 2957025d42e8daadf937d4044516f991d21deea4 - x-ms-parameter-location: method filesSearchFilter: name: search in: query @@ -16588,7 +19511,7 @@ components: daysParam: name: days in: query - description: Number of days with data to return. + description: Number of days of data to return (1-365, defaults to 31) schema: maximum: 365 minimum: 1 @@ -16601,7 +19524,7 @@ components: resultDataIdParam: name: issueId in: path - description: Identifier of an open issue. + description: Identifier of an open issue required: true schema: type: integer @@ -16633,7 +19556,7 @@ components: paymentPlanCodeParam: name: paymentPlanCode in: query - description: Payment plan code (available codes can be retrieved using the plans API) + description: Payment plan code (available codes can be retrieved using [listPaymentPlans](#listpaymentplans)) required: true schema: type: string @@ -16643,17 +19566,26 @@ components: repositoryFilterParam: name: filter in: query - description: RepositoryFilter + description: Filter for which repositories to return. Use `Synced` for repositories the user has access to, `NotSynced` for repositories fetched from the provider, or `AllSynced` for all organization repositories (requires admin access) schema: $ref: '#/components/schemas/RepositoryFilter' example: Synced x-ms-parameter-location: method x-ms-enum: name: RepositoryFilter + stackTagsFilterParam: + name: stackTags + in: query + description: Comma-separated list of detected stack tags to filter repositories by + schema: + type: string + x-ms-parameter-location: method + example: fwk:react,lib:lodash,tool:eslint + x-ms-parameter-location: method onlyMembersParam: name: onlyMembers in: query - description: If true, returns only Codacy users. If false, returns also commit authors that aren't Codacy users. + description: If true, returns only Codacy users. If false, returns also commit authors that are not Codacy users. schema: type: boolean default: false @@ -16663,7 +19595,7 @@ components: branchStatusParam: name: enabled in: query - description: Returns only the enabled or disabled branches. + description: Filter by branch status. Set to `true` to return only enabled branches, or `false` to return only disabled branches schema: type: boolean x-ms-parameter-location: method @@ -16690,7 +19622,7 @@ components: accountIdentifierParam: name: accountIdentifier in: path - description: Account Identifier + description: Unique identifier for the account required: true schema: type: integer @@ -16700,7 +19632,7 @@ components: tokenIdParam: name: tokenId in: path - description: API token ID + description: Unique identifier for the API token required: true schema: type: integer @@ -16708,10 +19640,47 @@ components: x-ms-parameter-location: method example: 30 x-ms-parameter-location: method + adminEntityGroupSlugParam: + name: adminEntityGroupSlug + in: path + description: Admin entity group slug + required: true + schema: + type: string + example: repositories + x-ms-parameter-location: method + adminEntityIdentifierParam: + name: adminEntityIdentifier + in: path + description: Admin entity identifier + required: true + schema: + type: integer + format: int64 + x-ms-parameter-location: method + example: 1337 + adminResourceSlugParam: + name: adminResourceSlug + in: path + description: Admin resource slug + required: true + schema: + type: string + x-ms-parameter-location: method + example: members + adminActionSlugParam: + name: adminActionSlug + in: path + description: Admin action slug + required: true + schema: + type: string + x-ms-parameter-location: method + example: update-settings metricNameParam: name: metricName in: path - description: Metric name + description: Name of the metric to retrieve. Get all available metrics using [readyMetricsForOrganization](#readymetricsfororganization) required: true schema: type: string @@ -16728,14 +19697,40 @@ components: x-ms-parameter-location: method example: my-enterprise x-ms-parameter-location: method + filesPathParam: + name: path + in: query + description: | + Relative path of the folder whose direct child files are listed. + When absent, all files in the repository are returned (recursive). + When empty, only files at the repository root are returned. + schema: + type: string + x-ms-parameter-location: method + example: src/main + x-ms-parameter-location: method filesSortParam: name: sort in: query - description: Field used to sort the list of files. The allowed values are 'filename', 'issues', 'grade', 'duplication', 'complexity', and 'coverage'. + description: | + Field used to sort the results. + For files the valid values are `filename`, `issues`, `grade`, `duplication`, `complexity`, and `coverage`. + For folders the valid values are `name`, `issues`, `grade`, `duplication`, `complexity`, and `coverage`. schema: type: string x-ms-parameter-location: method - example: category + example: issues + x-ms-parameter-location: method + directoriesPathParam: + name: path + in: query + description: | + Path of the folder whose child folders are listed. + When absent or empty, the folders at the repository root are returned. + schema: + type: string + x-ms-parameter-location: method + example: src/main x-ms-parameter-location: method fileIdParam: name: fileId @@ -16759,7 +19754,8 @@ components: sourceCodingStandardParam: name: sourceCodingStandard in: query - description: Identifier of an existing coding standard to use as a template when creating a new coding standard, including the enabled repositories and default coding standard status + description: | + Identifier of an existing coding standard to use as a template when creating a new coding standard, including the enabled repositories and default coding standard status schema: type: integer format: int64 @@ -16788,6 +19784,15 @@ components: x-ms-parameter-location: method example: 1 x-ms-parameter-location: method + reportUuid: + name: reportUuid + in: path + description: UUID string that identifies the coverage report + required: true + schema: + type: string + x-ms-parameter-location: method + example: 80f64371-e6bc-4d9b-b022-7c873cc5e39f filePathParam: name: filePath in: path @@ -16832,7 +19837,7 @@ components: srmStatusParam: name: status in: query - description: Security issue status to filter by. See [SrmStatus](#tocssrmstatus) for possible values. + description: Security issue status to filter by. See [SrmStatus](#tocssrmstatus) for valid values. style: form explode: true schema: @@ -16852,7 +19857,7 @@ components: srmPriorityParam: name: priority in: query - description: Security issue priorities to filter by. See [SrmPriority](#tocssrmpriority) for possible values. + description: Security issue priorities to filter by. See [SrmPriority](#tocssrmpriority) for valid values. style: form explode: true schema: @@ -16883,7 +19888,7 @@ components: srmScanTypeParam: name: scanType in: query - description: Security scan type to filter by. + description: Security scan type to filter by style: form explode: true schema: @@ -16896,7 +19901,7 @@ components: srmItemIdParam: name: srmItemId in: path - description: Id of the security and risk management item. + description: Identifier of the security and risk management item required: true schema: type: string @@ -16907,7 +19912,7 @@ components: srmItemsSortByParam: name: sort in: query - description: Field to sort SRM items by. + description: Field to sort SRM items by schema: type: string enum: @@ -16927,10 +19932,28 @@ components: x-ms-parameter-location: method example: 1 x-ms-parameter-location: method + imageNameParam: + name: imageName + in: path + description: Image name of the SBOM Image + required: true + schema: + type: string + x-ms-parameter-location: method + x-ms-parameter-location: method + imageTagParam: + name: tag + in: path + description: Image Tag of the SBOM Image + required: true + schema: + type: string + x-ms-parameter-location: method + x-ms-parameter-location: method elementTypeParam: name: elementType in: query - description: Codacy element type + description: Type of Codacy element to filter by required: true schema: type: string @@ -16949,7 +19972,7 @@ components: elementIdParam: name: elementId in: query - description: Codacy element identifier + description: Unique identifier of the Codacy element required: true schema: type: string @@ -16959,7 +19982,7 @@ components: jiraTicketIdentifierParam: name: jiraTicketIdentifier in: path - description: Jira Ticket Identifier + description: Unique identifier of the Jira ticket required: true schema: type: integer @@ -16980,7 +20003,7 @@ components: jiraProjectIdParam: name: jiraProjectId in: path - description: Identification of a Jira project. + description: Identifier of a Jira project required: true schema: type: integer @@ -16991,13 +20014,24 @@ components: jiraIssueTypeIdParam: name: jiraIssueTypeId in: path - description: Identification of a Jira project issue type. + description: Identifier of a Jira project issue type required: true schema: type: string x-ms-parameter-location: method example: '123351656' x-ms-parameter-location: method + webhookIdParam: + name: webhookId + in: path + description: Identifier of the webhook endpoint + required: true + schema: + type: string + format: uuid + x-ms-parameter-location: method + example: 80f64371-e6bc-4d9b-b022-7c873cc5e39f + x-ms-parameter-location: method baseCommitUuid: name: baseCommitUuid in: path @@ -17052,7 +20086,7 @@ components: segmentKeyPathParam: name: segmentKey in: path - description: Key of the segment. + description: Unique key identifier for the segment required: true schema: type: string @@ -17062,7 +20096,7 @@ components: dastTargetIdParam: name: dastTargetId in: path - description: Identification of a DAST analysis target. + description: Identifier of a DAST analysis target required: true schema: type: integer @@ -17078,6 +20112,12 @@ components: schema: $ref: '#/components/schemas/SearchRepositoryIssuesBody' required: false + searchIgnoredIssuesFilter: + description: Only return issues matching these filters + content: + application/json: + schema: + $ref: '#/components/schemas/SearchRepositoryIgnoredIssuesBody' emailParam: description: Email content: