Skip to content

@collectivtech/alana-sdk-js


@collectivtech/alana-sdk-js / resources/file / SecureFileStore

Class: SecureFileStore ​

Defined in: src/resources/file.ts:128

The Secure File Store is a business-specific resource. It is not created automatically, but can be accessed as the secureFileStore property of a Business object. All methods require a valid login; there are no "guest" endpoints in this API module.

Extends ​

Constructors ​

Constructor ​

new SecureFileStore(business, context): SecureFileStore

Defined in: src/resources/file.ts:134

Parameters ​

business ​

Business

context ​

ApiContext

Returns ​

SecureFileStore

Overrides ​

ApiResource.constructor

Properties ​

_context ​

protected _context: ApiContext

Defined in: src/resource.ts:148

The API context for this resource.

Inherited from ​

ApiResource._context

Methods ​

get() ​

get(path): Promise<SecureFile>

Defined in: src/resources/file.ts:146

Retrieve a single file from the Secure File Store.

This will include a access URL that is valid for a period of up to 1 hour.

Parameters ​

path ​

string

The path of the file to retreive

Returns ​

Promise<SecureFile>


list() ​

list(query?): Promise<Page<SecureFile>>

Defined in: src/resources/file.ts:164

Get a list of documents in the business's Secure File Store. This will only return metadata, not the documents themselves.

Parameters ​

query? ​

PaginationOptions

Optional pagination parameters

Returns ​

Promise<Page<SecureFile>>


prepareUpload() ​

prepareUpload(metadata): Promise<SecureUpload>

Defined in: src/resources/file.ts:226

Prepare for a file to be uploaded to the Secure File Store. This allows storing the internal metadata necessary for the file while handing off the secure upload URL to a user who may not have full access to the Business owning this Secure File Store.

The response for this method is an object with 2 defined properties. url is the signed, secure upload URL that will accept the file. fields is an opaque object containing necessary security credentials for the upload.

To use this response, send a POST request to the address in the url property. The body of this request must be multipart form data. Store the file with the name "file", and add every field in the fields property exactly as it is given.

Parameters ​

metadata ​

SecureUploadMetadata

The metadata for the file that will be uploaded

Returns ​

Promise<SecureUpload>


search(text, query?): Promise<Page<SecureFile>>

Defined in: src/resources/file.ts:187

Search for documents within the Secure File Store of a business. This will search both the name and path, but not the contents.

Parameters ​

text ​

string

The search text

query? ​

PaginationOptions

Optional pagination parameters

Returns ​

Promise<Page<SecureFile>>


upload() ​

upload(file, metadata): Promise<boolean>

Defined in: src/resources/file.ts:253

Upload a document to the Secure File Store.

Internally, this is a 2-step process, but both steps are handled transparently. To have full control over the process, call the prepareUpload() method with the file's metadata, then make a POST as instructed in that method's documentation.

Parameters ​

file ​

File

The file object to upload

metadata ​

SecureUploadMetadata

Metadata for the upload

Returns ​

Promise<boolean>

ALANA™, ALANA Platform™, ALANA Guide™, and ALANA Partner™ are trademarks of Collectiv Technologies Inc.