Skip to content

Cloudmersive/Cloudmersive.APIClient.NETCore.VirusScan

Repository files navigation

Cloudmersive.APIClient.NETCore.VirusScan - the C# library for the virusapi

The Cloudmersive Virus Scan API lets you scan files and content for viruses and identify security issues with content.

This C# SDK is automatically generated by the OpenAPI Generator project:

  • API version: v1
  • SDK version: 4.0.0
  • Generator version: 7.12.0
  • Build package: org.openapitools.codegen.languages.CSharpClientCodegen

Frameworks supported

  • .NET Core >=1.0
  • .NET Framework >=4.6
  • Mono/Xamarin >=vNext

Dependencies

The DLLs included in the package may not be the latest version. We recommend using NuGet to obtain the latest version of the packages:

Install-Package RestSharp
Install-Package Newtonsoft.Json
Install-Package JsonSubTypes
Install-Package System.ComponentModel.Annotations

NOTE: RestSharp versions greater than 105.1.0 have a bug which causes file uploads to fail. See RestSharp#742. NOTE: RestSharp for .Net Core creates a new socket for each api call, which can lead to a socket exhaustion problem. See RestSharp#1406.

Installation

Generate the DLL using your preferred tool (e.g. dotnet build)

Then include the DLL (under the bin folder) in the C# project, and use the namespaces:

using Cloudmersive.APIClient.NETCore.VirusScan.Api;
using Cloudmersive.APIClient.NETCore.VirusScan.Client;
using Cloudmersive.APIClient.NETCore.VirusScan.Model;

Usage

To use the API client with a HTTP proxy, setup a System.Net.WebProxy

Configuration c = new Configuration();
System.Net.WebProxy webProxy = new System.Net.WebProxy("http://myProxyUrl:80/");
webProxy.Credentials = System.Net.CredentialCache.DefaultCredentials;
c.Proxy = webProxy;

Getting Started

using System.Collections.Generic;
using System.Diagnostics;
using Cloudmersive.APIClient.NETCore.VirusScan.Api;
using Cloudmersive.APIClient.NETCore.VirusScan.Client;
using Cloudmersive.APIClient.NETCore.VirusScan.Model;

namespace Example
{
    public class Example
    {
        public static void Main()
        {

            Configuration config = new Configuration();
            config.BasePath = "https://api.cloudmersive.com";
            // Configure API key authorization: Apikey
            config.ApiKey.Add("Apikey", "YOUR_API_KEY");
            // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
            // config.ApiKeyPrefix.Add("Apikey", "Bearer");

            var apiInstance = new ScanApi(config);
            var inputFile = new System.IO.MemoryStream(System.IO.File.ReadAllBytes("/path/to/file.txt"));  // System.IO.Stream | Input file to perform the operation on.

            try
            {
                // Scan a file for viruses
                VirusScanResult result = apiInstance.ScanFile(inputFile);
                Debug.WriteLine(result);
            }
            catch (ApiException e)
            {
                Debug.Print("Exception when calling ScanApi.ScanFile: " + e.Message );
                Debug.Print("Status Code: "+ e.ErrorCode);
                Debug.Print(e.StackTrace);
            }

        }
    }
}

Documentation for API Endpoints

All URIs are relative to https://api.cloudmersive.com

Class Method HTTP request Description
ScanApi ScanFile POST /virus/scan/file Scan a file for viruses
ScanApi ScanFileAdvanced POST /virus/scan/file/advanced Advanced Scan a file for viruses
ScanApi ScanWebsite POST /virus/scan/website Scan a website for malicious content and threats
ScanCloudStorageApi ScanCloudStorageGetAsyncJobStatus GET /virus/scan/cloud-storage/batch-job/status Get the status and result of a Scan Cloud Storage Batch Job
ScanCloudStorageApi ScanCloudStorageScanAwsS3File POST /virus/scan/cloud-storage/aws-s3/single Scan an AWS S3 file for viruses
ScanCloudStorageApi ScanCloudStorageScanAwsS3FileAdvanced POST /virus/scan/cloud-storage/aws-s3/single/advanced Advanced Scan an AWS S3 file for viruses
ScanCloudStorageApi ScanCloudStorageScanAzureBlob POST /virus/scan/cloud-storage/azure-blob/single Scan an Azure Blob for viruses
ScanCloudStorageApi ScanCloudStorageScanAzureBlobAdvanced POST /virus/scan/cloud-storage/azure-blob/single/advanced Advanced Scan an Azure Blob for viruses
ScanCloudStorageApi ScanCloudStorageScanAzureBlobAdvancedBatchJob POST /virus/scan/cloud-storage/azure-blob/single/advanced/batch-job Advanced Scan an Azure Blob for viruses via a batch job
ScanCloudStorageApi ScanCloudStorageScanGcpStorageFile POST /virus/scan/cloud-storage/gcp-storage/single Scan an Google Cloud Platform (GCP) Storage file for viruses
ScanCloudStorageApi ScanCloudStorageScanGcpStorageFileAdvanced POST /virus/scan/cloud-storage/gcp-storage/single/advanced Advanced Scan an Google Cloud Platform (GCP) Storage file for viruses
ScanCloudStorageApi ScanCloudStorageScanSharePointOnlineFile POST /virus/scan/cloud-storage/sharepoint-online/site/single Virus Scan a file in a SharePoint Online Site Drive
ScanCloudStorageApi ScanCloudStorageScanSharePointOnlineFileAdvanced POST /virus/scan/cloud-storage/sharepoint-online/site/advanced Advanced Virus Scan a file in a SharePoint Online Site Drive

Documentation for Models

Documentation for Authorization

Authentication schemes defined for the API:

Apikey

  • Type: API key
  • API key parameter name: Apikey
  • Location: HTTP header

About

.NET Core API Client for Cloudmersive Virus Scan API

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages