Node.js client for the REST API of Classeur.
- Source:
- See:
-
The ClasseurClient class for API usage information.
The README for an overview and more usage examples.
The source code on GitHub.
classeur-downloader for an example use case for this module.
Examples
Installation
npm install classeur-api-client
Usage
const ClasseurClient = require('classeur-api-client') const myClient = new ClasseurClient('my user id', 'my api key') myClient.getFile('some file id', function(error, result) { console.log(`Got a file called ${result.name}`) console.log(`...and some markdown: ${result.content.text}`) })
Classes
Type Definitions
-
File
-
Object representation of a Classeur file.
Type:
- Object
- Source:
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
module:classeur-api-client.FileContent The content of the file.
-
FileContent
-
Object representation of a Classeur file's content.
Type:
- Object
- Source:
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.
-
FileMetadata
-
Object representation of a Classeur file's metadata.
Type:
- Object
- Source:
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.
-
Folder
-
Object representation of a Classeur folder.
Type:
- Object
- Source:
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.<module:classeur-api-client.FolderFileEntry> List of objects, each representing a file contained within the folder.
-
FolderFileEntry
-
Object representation of a Classeur file entry in a folder.
Type:
- Object
- Source:
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.
-
FolderMetadata
-
Object representation of a Classeur folder's metadata.
Type:
- Object
- Source:
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.
-
ScrubbedCallback(error, result)
-
Standard
function(error, result) { ... }
callbacks that get automatically wrapped so that eithererror
orresult
must benull
.- Write your callbacks like you normally would they will be scrubbed automatically. Code in scrubbed callbacks does not have to worry about cases in which both arguments passed to the callback will be non-
null
at least one will always benull
(callbacks that expectnull
as a result will still work).
Parameters:
Name Type Argument Description error
module:classeur-api-client.ServerError | module:classeur-api-client.ClientError <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.error
will be a ServerError or ClientError, ornull
on success.- All functions in this module will supply a ServerError or ClientError (both of which are instances of Error) to their callback there is no need to check for stringy errors.
error
will always benull
(notundefined
or another falsy value) if no error occurred.
result
* <nullable>
Result of the function to which this callback was supplied, or
null
if the function was unsuccessful.- For type information of
result
, see the documentation for the function to which the callback was passed. result
will benull
even if the function was partially successful, and was supposed to return an Array partial result arrays are not supported.
- Source:
- Write your callbacks like you normally would they will be scrubbed automatically. Code in scrubbed callbacks does not have to worry about cases in which both arguments passed to the callback will be non-
-
UserMetadata
-
Object representation of a Classeur user's metadata.
Type:
- Object
- Source:
Properties:
Name Type Description id
String The ID of the user.
name
String The name of the user.