Skip to main content

Sanitize | C# SDK

Sanitize

SanitizeClient

Sanitize client.

var config = new Config("pangea_token", "pangea_domain");
var builder = new SanitizeClient.Builder(config);
var client = builder.Build();

Sanitize

SanitizeClient.Sanitize(SanitizeRequest, FileStream)

Apply file sanitization actions according to specified rules.

required parameters

SanitizeRequest

Request parameters.

FileStream

File to sanitize.

Response Object

Task<Response<SanitizeResult>>

The sanitized file and information on the sanitization that was performed.

var file = new FileStream("/path/to/file.pdf", FileMode.Open, FileAccess.Read);
var response = await client.Sanitize(
    new SanitizeRequest()
    {
        RequestTransferMethod = TransferMethod.PostURL,
        UploadedFileName = "uploaded_file",
    },
    file
);

Sanitize via presigned URL

SanitizeClient.RequestUploadURL(SanitizeRequest)

Apply file sanitization actions according to specified rules via a presigned URL.

required parameters

SanitizeRequest

Request parameters.

Response Object

Task<Response<AcceptedResult>>

A presigned URL.

var presignedUrl = await client.RequestUploadURL(
    new SanitizeRequest()
    {
        RequestTransferMethod = TransferMethod.PutURL,
        UploadedFileName = "uploaded_file",
    }
);

// Upload file to `presignedUrl.Result.PutURL`.

// Poll for Sanitize's result.
var response = await client.PollResult<SanitizeResult>(presignedUrl.RequestId);