Skip to content

DocumentsResource

API reference for the Documents resource.

Methods

list

List all documents with optional filtering.

typescript
async list(options?: ListOptions): Promise<ListResponse<Document>>

get

Get a single document by ID.

typescript
async get(id: string): Promise<Document>

create

Create a new document.

typescript
async create(data: CreateDocumentInput): Promise<Document>

Parameters:

typescript
interface CreateDocumentInput {
  fileName: string;
  docType?: string;
  displayName?: string;
  status?: 'Current' | 'Draft' | 'Expired';
  owner?: string;
  classification?: string;
  nextReviewDate?: Date;
  comments?: string;
}

update

Update an existing document.

typescript
async update(id: string, data: UpdateDocumentInput): Promise<Document>

delete

Delete a document.

typescript
async delete(id: string): Promise<void>

upload

Upload a document file.

typescript
async upload(file: File | Buffer, metadata: CreateDocumentInput): Promise<Document>

download

Download a document file.

typescript
async download(id: string): Promise<Blob>

Search documents by text.

typescript
async search(query: string): Promise<Document[]>

review

Mark a document as reviewed.

typescript
async review(id: string, notes?: string): Promise<Document>

Types

Document

typescript
interface Document {
  id: string;
  type: 'document';
  fileName: string;
  docType?: string;
  documentType?: string;
  displayName?: string;
  status: 'Current' | 'Draft' | 'Expired' | 'Published' | 'Active' | 'In Review';
  owner?: string;
  classification?: string;
  nextReviewDate?: Date;
  lastReviewDate?: Date;
  createdAt: Date;
  updatedAt: Date;
  dateUploaded?: Date;
  comments?: string;
  componentId?: string;
  docID?: string;
}

Released under the MIT License.