class SimpleNote
Constructor
| Constructor | Parameters | Returns |
|---|---|---|
SimpleNote(
)
|
Properties
| Properties | Type | Description |
|---|---|---|
_baseURL
|
String
private
final
|
↑
Contains the base URL of the API. |
_debugEnabled
|
Boolean
private
|
↑
Enables console output of debugging messages.
Default value:
|
_email
|
String
private
|
↑
After a successful login, this variable holds the account email address required for all subsequent API requests. |
_token
|
String
private
|
↑
After a successful login, this variable holds the auth token required for all subsequent API requests. |
_version
|
String
private
final
|
↑
The simplenote-js version number. |
_yqlTableName
|
String
private
final
|
↑
Contains the table name used in YQL query. |
_yqlTableURL
|
String
private
|
↑
Contains the OpenData table used for all YQL calls.
Default value:
|
VERSION
|
String
final
|
↑
Returns the simplenote-js version number. |
Methods
| Methods | Returns | Description |
|---|---|---|
_authenticate(
config
)
|
void
private
|
↑
Authenticates the client. The request is made asynchronously via YQL. Throws an exception if one of the arguments is missing or empty. Parameters:
|
_clearCredentials(
)
|
void
private
|
↑
Deletes both |
_createNote(
config
)
|
void
private
|
↑
Creates a new note. Returns the new note ID. Throws an exception if one of the arguments is missing or empty. Parameters:
|
_deleteNote(
config
)
|
void
private
|
↑
Deletes an existing note. Throws an exception if one of the arguments is missing or empty. Parameters:
|
_getErrorCode(
status
)
|
void
private
|
↑
Returns an error code for a passed HTTP status. Parameters:
|
_getYQLURL(
query
)
|
void
private
|
↑
Accepts a YQL query and returns the related YQL URL. Parameters:
|
_isLoggedIn(
)
|
Boolean
private
|
↑
Returns a boolean showing whether the user is currently logged in or not. |
_queryYQL(
caller, query, cbSuccess, cbError, context
)
|
void
private
|
↑
Proxy method abstracting most YQL calls. Parameters:
|
_retrieveIndex(
config
)
|
void
private
|
↑
Returns an index of all notes. This method will return a JSON object with
three main properties for each note: Throws an exception if one of the arguments is missing or empty. The index will be returned as an array containing hashes. The hashes contain the following keys:
Parameters:
|
_retrieveNote(
config
)
|
void
private
|
↑
Retrieves and returns a single note as a hash in the following form:
Throws an exception if one of the arguments is missing or empty. Parameters:
|
_searchNotes(
config
)
|
void
private
|
↑
Returns notes containing a particular term. Throws an exception if one of the arguments is missing or empty. This method will return a JSON object with two keys, Each note is represented as an object containing two keys, Parameters:
|
_throwUnlessLoggedIn(
)
|
void
private
|
↑
Throws an exception if either the internal email or token aren't set (which means the user's not logged in). |
_updateNote(
config
)
|
void
private
|
↑
Updates an existing note. Returns the note ID on success. Throws an exception if one of the arguments is missing or empty. Parameters:
|
_validateRetrievalConfig(
obj
)
|
void
private
|
↑
Checks if the passed argument is an object and has Parameters:
|
auth(
config
)
|
void
|
↑
Authenticates the client. The request is made asynchronously via YQL. Throws an exception if one of the arguments is missing or empty. Parameters:
|
createNote(
config
)
|
void
|
↑
Creates a new note. Returns the new note ID. Throws an exception if one of the arguments is missing or empty. Parameters:
|
deleteNote(
config
)
|
void
|
↑
Deletes an existing note. Throws an exception if one of the arguments is missing or empty. Parameters:
|
enableDebug(
bool
)
|
void
|
↑
Enables console output of debugging messages. Parameters:
|
getAuthDetails(
)
|
Object
|
↑
Returns auth details, i.e. an object containing the current email address and auth token returned by the API after a successful login. Returns:
|
getOpenDataTable(
)
|
String
|
↑
Returns the Open Data table used in all YQL requests. Returns:
|
isLoggedIn(
)
|
Boolean
|
↑
Returns a boolean showing whether the user is currently logged in or not. |
retrieveIndex(
config
)
|
void
|
↑
Returns an index of all notes. This method will return a JSON object with
three main properties for each note: Throws an exception if one of the arguments is missing or empty. Parameters:
|
retrieveNote(
config
)
|
void
|
↑
Retrieves and returns a single note as a hash in the following form:
Throws an exception if one of the arguments is missing or empty. Parameters:
|
searchNotes(
config
)
|
void
|
↑
Returns notes containing a particular term. Throws an exception if one of the arguments is missing or empty. This method will return a JSON object with two keys, Each note is represented as an object containing two keys, Parameters:
|
setOpenDataTable(
)
|
void
|
↑
Sets the Open Data table used in all YQL requests. Usually, you'll want
to put the Open Data table XML file (see |
updateNote(
config
)
|
void
|
↑
Updates an existing note. Returns the note ID on success. Throws an exception if one of the arguments is missing or empty. Parameters:
|