Table of Contents

Interface IDocumentApi

Namespace: Casewhere.Runtime.DSL.Api
Assembly: Casewhere.Runtime.dll

Provides methods for working with documents.

public interface IDocumentApi : IDslApi

Implements

IDslApi

Extension Methods

ObjectExtension.ConvertToBsonValue(object), EnumExtensions.DeepClone<IDocumentApi>(IDocumentApi)

Methods

Create(string)

Create new empty document with a given file name.

DocumentInfo Create(string fileName)

Parameters

fileName string

The file name.

Returns

DocumentInfo

The document object.

Delete(DocumentInfo)

Delete a document.

void Delete(DocumentInfo document)

Parameters

document DocumentInfo

The document information.

GetMalwareScanStatus(DocumentInfo)

Get the malware scan status of a given document. If the antimalware feature is enabled, then return the status based on the scanning result. Otherwise, always return the Cleaned status.

MalwareScanStatus GetMalwareScanStatus(DocumentInfo documentInfo)

Parameters

documentInfo DocumentInfo

A given document.

Returns

MalwareScanStatus

The malware scanning status.

IsFileExisted(DocumentInfo)

Check a document is existed.

bool IsFileExisted(DocumentInfo document)

Parameters

document DocumentInfo

The document information.

Returns

bool

A flag to indicate the document is exists or not.

OpenRead(DocumentInfo)

Open a document for reading.

Stream OpenRead(DocumentInfo document)

Parameters

document DocumentInfo

The document information.

Returns

Stream

A read-only stream.

OpenWrite(DocumentInfo)

Open a document for writing.

Stream OpenWrite(DocumentInfo document)

Parameters

document DocumentInfo

The document information.

Returns

Stream

A writable stream.

ReadAllBytes(DocumentInfo)

Reads the contents of the file into a byte array.

byte[] ReadAllBytes(DocumentInfo document)

Parameters

document DocumentInfo

The document information.

Returns

byte[]

The byte array.

ReadToStream(DocumentInfo, Stream)

Reads the contents of a blob to a stream.

void ReadToStream(DocumentInfo document, Stream stream)

Parameters

document DocumentInfo

The document information.

stream Stream

The stream.

RequestMalwareScanning(DocumentInfo)

Manually make a file scan request for a specific document.

void RequestMalwareScanning(DocumentInfo documentInfo)

Parameters

documentInfo DocumentInfo

A given document

SecureShare(DocumentInfo, DateTime?, int?, List<string>)

Share document with more secured parameters

string SecureShare(DocumentInfo document, DateTime? endDate = null, int? maxDownloadTimes = null, List<string> whitelistedIps = null)

Parameters

document DocumentInfo

The document information.

endDate DateTime?

Time to deactivate the shared token

maxDownloadTimes int?

Deactivate the shared token when reaching the max value

whitelistedIps List<string>

A list of IP addresses that are allowed to access the shared document

Returns

string

A shared token

Share(DocumentInfo, DateTime?, int?)

Share document

[Obsolete("This method is not safe. Please use SecureShare for more security.")]
string Share(DocumentInfo document, DateTime? endDate = null, int? maxDownloadTimes = null)

Parameters

document DocumentInfo

The document information.

endDate DateTime?

Time to deactivate the shared token

maxDownloadTimes int?

Deactivate the shared token when reaching the max value

Returns

string

A shared token

Store(DocumentInfo, byte[])

Stores document with a byte array. If the document already exists, it will be overwritten.

void Store(DocumentInfo document, byte[] data)

Parameters

document DocumentInfo

The document information.

data byte[]

The byte array.

Store(DocumentInfo, Stream)

Stores document with a stream. If the document already exists, it will be overwritten.

void Store(DocumentInfo document, Stream stream)

Parameters

document DocumentInfo

The document information.

stream Stream

The stream.

Unshare(string)

Deactivate the token

void Unshare(string tokenId)

Parameters

tokenId string

The token