@roughapp/sdk
v4.3.0
Published
A TypeScript SDK for interacting with the Rough API.
Readme
@roughapp/sdk
A TypeScript SDK for interacting with the Rough API.
Installation
npm install @roughapp/sdkAuthorization
All API requests require an Authorization header with a Bearer token. When making requests, include your API key like this:
import { client, getDocumentList } from '@roughapp/sdk'
// Option 1: use the same API key for all requests
client.setConfig({ auth: () => 'your-api-key' })
// Option 2: manually pass an API key
const response = await getDocumentList({
auth: 'your-api-key'
})Available Endpoints
Documents
// Get all documents
const documents = await getDocumentList({
query: { includeArchived: 'false' }
})
// Get a specific document
const document = await getDocument({
path: { documentId: "123" }
})Notes
getNoteList()- Get all notescreateNote()- Create a new notegetNote()- Get a specific notedeleteNote()- Delete a note
People
getPersonList()- List all peoplecreatePerson()- Create a new persongetPerson()- Get a specific persongetPersonByEmail()- Find person by emailupsertPerson()- Create or update a person
Other Resources
getWorkspace()- Get workspace detailsgetContentList()- List all contentgetLabelList()- List all labelsgetReferenceList()- List all referencesgetUserList()- List all users
OAuth2 Authentication
For OAuth2 authentication flows:
import { createRoughOAuth2Provider } from '@roughapp/sdk'
const oauth2 = createRoughOAuth2Provider({
baseUrl: 'https://in.rough.app',
clientId: 'YOUR_CLIENT_ID',
clientSecret: 'YOUR_CLIENT_SECRET',
redirectUri: 'YOUR_REDIRECT_URI'
})Uploading Files
import { createAsset } from '@roughapp/sdk'
import { readFile } from 'node:fs/promises'
const buffer = await readFile('./image.jpg')
const blob = new Blob(buffer)
const asset = await createAsset({
auth: 'your-api-token',
body: {
file: blob,
}
})
// You can now use `asset.url` to reference the uploaded file.For detailed API documentation and request/response types, please refer to the source code or contact Rough support.
