Class: ClasseurClient

ClasseurClient

Object-oriented interface to the Classeur REST API.


new ClasseurClient(userId, apiKey, host)

Constructs a new API client.

Parameters:
Name Type Argument Default Description
userId string

Classeur user ID string.

apiKey string

API Key string. Keep this secret.

host string <optional>
app.classeur.io

Fully qualified hostname to connect to. Can be prefixed with http:// or https://.

Source:
Returns:

Returns a ClasseurClient instance.

Type
Object
Example
const ClasseurClient = require('classeur-api-client'),
     client = new ClasseurClient('my user id', 'my api key');

Methods


getFile(id, callback)

Retrieve a single file.

Parameters:
Name Type Description
id String

Classeur file ID to retrieve.

callback ClasseurClient~scrubbedCallback

Called with (error, result).

Source:

getFileMetadata(id, callback)

Retrieve metadata for a file.

Parameters:
Name Type Description
id String

The Classeur file ID for which to retrieve metadata.

callback ClasseurClient~scrubbedCallback

Called with (error, result).

Source:

getFiles(ids, callback)

Retrieve one or more files.

Parameters:
Name Type Description
ids Array.<String>

Array of Classeur file IDs to retrieve.

callback ClasseurClient~scrubbedCallback(?(Error))

Called with (error, result).

Source:

getFiles(ids, callback)

Retrieve one or more files.
Like ClasseurClient#getFiles, but with spread: accepts a variable number of file IDs in the arguments, instead of an Array.

Parameters:
Name Type Argument Description
ids String <repeatable>

Classeur file IDs to retrieve.

callback ClasseurClient~scrubbedCallback

Called with (error, result).

Source:

getFilesMetadata(ids, callback)

Retrieve metadata for one or more files.

Parameters:
Name Type Description
ids Array.<String>

Array of Classeur file IDs for which to retrieve metadata.

callback ClasseurClient~scrubbedCallback

Called with (error, result).

Source:

getFilesMetadata(ids, callback)

Like ClasseurClient#getUsersMetadata, but with spread: accepts a variable number of folder IDs in the arguments, instead of an Array.

Parameters:
Name Type Argument Description
ids String <repeatable>

Classeur file IDs for which to retrieve metadata.

callback ClasseurClient~scrubbedCallback

Called with (error, result).

Source:

getFolder(id, callback)

Retrieve a single folder.

Parameters:
Name Type Description
id String

Classeur folder ID to retrieve.

callback ClasseurClient~scrubbedCallback

Called with (error, result).

Source:

getFolderMetadata(id, callback)

Retrieve metadata for a folder.

Parameters:
Name Type Description
id String

The Classeur folder ID for which to retrieve metadata.

callback ClasseurClient~scrubbedCallback

Called with (error, result).

Source:

getFolders(ids, callback)

Retrieve one or more folders.

Parameters:
Name Type Description
ids Array.<String>

Array of Classeur folder IDs to retrieve.

callback ClasseurClient~scrubbedCallback

Called with (error, result).

Source:

getFolders(ids, callback)

Like ClasseurClient#getFolders, but with spread: accepts a variable number of folder IDs in the arguments, instead of an Array.

Parameters:
Name Type Argument Description
ids String <repeatable>

Classeur folder IDs to retrieve.

callback ClasseurClient~scrubbedCallback

Called with (error, result).

Source:

getFoldersMetadata(ids, callback)

Retrieve metadata for one or more folders.

Parameters:
Name Type Description
ids Array.<String>

Array of Classeur folder IDs for which to retrieve metadata.

callback ClasseurClient~scrubbedCallback

Called with (error, result).

Source:

getFoldersMetadata(ids, callback)

Like ClasseurClient#getUsersMetadata, but with spread: accepts a variable number of folder IDs in the arguments, instead of an Array.

Parameters:
Name Type Argument Description
ids String <repeatable>

Classeur folder IDs for which to retrieve metadata.

callback ClasseurClient~scrubbedCallback

Called with (error, result).

Source:

getUserMetadata(id, callback)

Retrieve metadata for a user.

Parameters:
Name Type Description
id String

The Classeur user ID for which to retrieve metadata.

callback ClasseurClient~scrubbedCallback

Called with (error, result).

Source:

getUsers(callback)

Retrieve all users on the Classeur account to which the ClasseurClient is connected.

Parameters:
Name Type Description
callback ClasseurClient~scrubbedCallback

Called with (error, result).

  • result will be an Array of ClasseurClient~User objects, or null on error.
Source:

getUsersMetadata(ids, callback)

Retrieve metadata for one or more users.

Parameters:
Name Type Description
ids Array.<String>

Array of Classeur user IDs for which to retrieve metadata.

callback ClasseurClient~scrubbedCallback

Called with (error, result).

Source:

getUsersMetadata(ids, callback)

Like ClasseurClient#getUsersMetadata, but with spread: accepts a variable number of folder IDs in the arguments, instead of an Array.

Parameters:
Name Type Argument Description
ids String <repeatable>

Classeur user IDs for which to retrieve metadata.

callback ClasseurClient~scrubbedCallback

Called with (error, result).

Source:

Type Definitions


File

Object representation of a Classeur file.

Type:
  • Object
Properties:
Name Type Description
id String

The ID of the file.

name String

The name of the file, as visible in the Classeur UI.

permission *

Information on the access permissions of the file.

updated Number

Timestamp (since epoch): the last time the file was updated.

content ClasseurClient~FileContent

The content of the file.

Source:

FileContent

Object representation of a Classeur file's content.

Type:
  • Object
Properties:
Name Type Description
text String

The text content of the file.

rev Number

The revision number of the file.

properties Object

File properties.

discussions Array.<Object>

Array of objects, each representing a discussion entry regarding this file.

Source:

FileMetadata

Object representation of a Classeur file's metadata.

Type:
  • Object
Properties:
Name Type Description
id String

The ID of the file.

name String

The name of the file, as visible in the Classeur UI.

permission *

Information on the access permissions of the file.

userId String

The ID of the user who owns the file.

updated Number

Timestamp (since epoch): the last time the file was updated.

Source:

Folder

Object representation of a Classeur folder.

Type:
  • Object
Properties:
Name Type Description
id String

The ID of the folder.

name String

The name of the folder, as visible in the Classeur UI.

userId String

The ID of the user who owns the folder.

updated Number

Timestamp (since epoch): the last time the folder was updated.

files Array.<ClasseurClient~FolderFileEntry>

List of objects, each representing a file contained within the folder.

Source:

FolderFileEntry

Object representation of a Classeur file entry in a folder.

Type:
  • Object
Properties:
Name Type Description
id String

The ID of the file.

name String

The name of the file, as visible in the Classeur UI.

userId String

The ID of the user who owns the file.

updated Number

Timestamp (since epoch): the last time the file was updated.

Source:

FolderMetadata

Object representation of a Classeur folder's metadata.

Type:
  • Object
Properties:
Name Type Description
id String

The ID of the folder.

name String

The name of the folder, as visible in the Classeur UI.

userId String

The ID of the user who owns the folder.

updated Number

Timestamp (since epoch): the last time the folder was updated.

Source:

scrubbedCallback(error, result)

Sanitizes function(error, result) { ... } callbacks. Enforces that either error or result must be null.

Parameters:
Name Type Argument Description
error Error | String <nullable>

An Error or error String, if an error occurred executing the function to which this callback was supplied, or null if the function was successful.

result * <nullable>

Results of the function to which this callback was supplied, or null if the function was unsuccessful.

  • result will be null even if the function was partially successful, and was supposed to return an Array; partial result arrays are removed.
Source:

UserMetadata

Object representation of a Classeur user's metadata.

Type:
  • Object
Properties:
Name Type Description
id String

The ID of the user.

name String

The name of the user.

Source: