Table of Contents

Class DocumentApi

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

public class DocumentApi : IDocumentApi, IDslApi

Inheritance

objectDocumentApi

Implements

IDocumentApi, IDslApi

Inherited Members

object.ToString(), object.Equals(object), object.Equals(object, object), object.ReferenceEquals(object, object), object.GetHashCode(), object.GetType(), object.MemberwiseClone()

Extension Methods

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

Constructors

DocumentApi(IFileStorage, ISharedTokenRepository, IFileScanRequestService)

public DocumentApi(IFileStorage fileStorage, ISharedTokenRepository sharedTokenRepository, IFileScanRequestService fileScanRequestService)

Parameters

fileStorage IFileStorage

sharedTokenRepository ISharedTokenRepository

fileScanRequestService IFileScanRequestService

Methods

Create(string)

Create new empty document with a given file name.

public DocumentInfo Create(string fileName)

Parameters

fileName string

The file name.

Returns

DocumentInfo

The document object.

Delete(DocumentInfo)

Delete a document.

public 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.

public MalwareScanStatus GetMalwareScanStatus(DocumentInfo documentInfo)

Parameters

documentInfo DocumentInfo

A given document.

Returns

MalwareScanStatus

The malware scanning status.

IsFileExisted(DocumentInfo)

Check a document is existed.

public 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.

public Stream OpenRead(DocumentInfo document)

Parameters

document DocumentInfo

The document information.

Returns

Stream

A read-only stream.

OpenWrite(DocumentInfo)

Open a document for writing.

public 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.

public 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.

public 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.

public void RequestMalwareScanning(DocumentInfo documentInfo)

Parameters

documentInfo DocumentInfo

A given document

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

Share document with more secured parameters

public 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

public 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.

public 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.

public void Store(DocumentInfo document, Stream stream)

Parameters

document DocumentInfo

The document information.

stream Stream

The stream.

Unshare(string)

Deactivate the token

public void Unshare(string tokenId)

Parameters

tokenId string

The token