Skip to content

cuteribs/Veracode.ApiClients

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Veracode.ApiClients

  • C# Wrappers for Veracode Rest API.
  • Generated with autorest and some manually fixes.
  • There are many bugs/errors in the swagger/openapi documentation provided by Veracode.

Example

using Microsoft.Extensions.DependencyInjection;
using Newtonsoft.Json;
using Veracode.ApiClients.Helper;
using Veracode.ApiClients.SCAAgent.Api;
using Veracode.ApiClients.SCAAgent.Api.Patches;

static void Main()
{
    ServiceCollection services = new();
    services.AddApiClient<ISCAAgentApiClient, SCAAgentApiClient>(o =>
    {
        o.ApiId = "xxxxxxxxxxxxxx";
        o.ApiKey = "xxxxxxxxxxxxxx";
        o.BaseUri = new("https://api.veracode.com/srcclr");
    }, client =>
    {
        // These custom converters are required for Veracode SCA Agent Api response deserialization.
        client.DeserializationSettings.Converters.Add(new EmbeddedPropertyConverter());
        client.DeserializationSettings.Converters.Add(new LinksPropertyConverter());
    });
    var serviceProvider = services.BuildServiceProvider();
    var client = serviceProvider.GetRequiredService<ISCAAgentApiClient>();

    var response = client.GetWorkspacesUsingGET();
    var result = response._embedded.Select(a => new
    {
        Name = a.Name,
        TotalProjects = a.ProjectsCount,
        TotalIssues = a.TotalIssuesCount,
        VulnerabilityIssues = a.VulnerabilityIssuesCount,
        LibraryIssues = a.LibraryIssuesCount,
        LicenseIssues = a.LicenseIssuesCount,
        LastScan = a.LastScanDate?.ToString("s")
    });

    Console.WriteLine("SCA Agent Workspaces");
    Console.WriteLine(JsonConvert.SerializeObject(result, Formatting.Indented));
}

About

C# Wrappers for Veracode Rest API

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages