@beauraines/rtm-api 1.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +285 -0
  3. package/config.js +22 -0
  4. package/docs/RTMClient.html +2798 -0
  5. package/docs/RTMError.html +1029 -0
  6. package/docs/RTMList.html +966 -0
  7. package/docs/RTMResponse.html +868 -0
  8. package/docs/RTMSuccess.html +337 -0
  9. package/docs/RTMTask.html +2461 -0
  10. package/docs/RTMUser.html +6761 -0
  11. package/docs/client_auth.js.html +123 -0
  12. package/docs/client_index.js.html +241 -0
  13. package/docs/client_user.js.html +170 -0
  14. package/docs/global.html +386 -0
  15. package/docs/index.html +305 -0
  16. package/docs/list_index.js.html +159 -0
  17. package/docs/response_error.js.html +172 -0
  18. package/docs/response_response.js.html +160 -0
  19. package/docs/response_success.js.html +104 -0
  20. package/docs/scripts/linenumber.js +25 -0
  21. package/docs/scripts/prettify/Apache-License-2.0.txt +202 -0
  22. package/docs/scripts/prettify/lang-css.js +2 -0
  23. package/docs/scripts/prettify/prettify.js +28 -0
  24. package/docs/styles/jsdoc.css +664 -0
  25. package/docs/styles/prettify.css +79 -0
  26. package/docs/task_helper.js.html +531 -0
  27. package/docs/task_index.js.html +304 -0
  28. package/docs/user_index.js.html +347 -0
  29. package/docs/user_lists.js.html +208 -0
  30. package/docs/user_tasks.js.html +703 -0
  31. package/jsdoc.json +13 -0
  32. package/package.json +33 -0
  33. package/src/client/auth.js +65 -0
  34. package/src/client/index.js +182 -0
  35. package/src/client/user.js +112 -0
  36. package/src/list/helper.js +131 -0
  37. package/src/list/index.js +101 -0
  38. package/src/response/error.js +114 -0
  39. package/src/response/index.js +8 -0
  40. package/src/response/parse.js +51 -0
  41. package/src/response/response.js +102 -0
  42. package/src/response/success.js +46 -0
  43. package/src/task/helper.js +469 -0
  44. package/src/task/index.js +264 -0
  45. package/src/user/index.js +288 -0
  46. package/src/user/lists.js +150 -0
  47. package/src/user/tasks.js +708 -0
  48. package/src/utils/auth.js +188 -0
  49. package/src/utils/fetch.js +67 -0
  50. package/src/utils/get.js +247 -0
  51. package/src/utils/sign.js +93 -0
  52. package/src/utils/taskIds.js +188 -0
@@ -0,0 +1,305 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <title>Home - Documentation</title>
6
+
7
+ <script src="scripts/prettify/prettify.js"></script>
8
+ <script src="scripts/prettify/lang-css.js"></script>
9
+ <!--[if lt IE 9]>
10
+ <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
11
+ <![endif]-->
12
+ <link type="text/css" rel="stylesheet" href="styles/prettify.css">
13
+ <link type="text/css" rel="stylesheet" href="styles/jsdoc.css">
14
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
15
+ </head>
16
+ <body>
17
+
18
+ <input type="checkbox" id="nav-trigger" class="nav-trigger" />
19
+ <label for="nav-trigger" class="navicon-button x">
20
+ <div class="navicon"></div>
21
+ </label>
22
+
23
+ <label for="nav-trigger" class="overlay"></label>
24
+
25
+ <nav>
26
+ <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="RTMClient.html">RTMClient</a><ul class='methods'><li data-type='method'><a href="RTMClient.html#get">get</a></li><li data-type='method'><a href="RTMClient.html#~auth/getAuthToken">auth/getAuthToken</a></li><li data-type='method'><a href="RTMClient.html#~auth/getAuthUrl">auth/getAuthUrl</a></li><li data-type='method'><a href="RTMClient.html#~auth/verifyAuthToken">auth/verifyAuthToken</a></li><li data-type='method'><a href="RTMClient.html#~user/create">user/create</a></li><li data-type='method'><a href="RTMClient.html#~user/export">user/export</a></li><li data-type='method'><a href="RTMClient.html#~user/exportToString">user/exportToString</a></li><li data-type='method'><a href="RTMClient.html#~user/import">user/import</a></li><li data-type='method'><a href="RTMClient.html#~user/importFromString">user/importFromString</a></li></ul></li><li><a href="RTMError.html">RTMError</a><ul class='methods'><li data-type='method'><a href="RTMError.html#.networkError">networkError</a></li><li data-type='method'><a href="RTMError.html#.rateLimitError">rateLimitError</a></li><li data-type='method'><a href="RTMError.html#.referenceError">referenceError</a></li><li data-type='method'><a href="RTMError.html#.responseError">responseError</a></li><li data-type='method'><a href="RTMError.html#.serverError">serverError</a></li><li data-type='method'><a href="RTMError.html#toString">toString</a></li></ul></li><li><a href="RTMList.html">RTMList</a></li><li><a href="RTMResponse.html">RTMResponse</a><ul class='methods'><li data-type='method'><a href="RTMResponse.html#has">has</a></li><li data-type='method'><a href="RTMResponse.html#toString">toString</a></li></ul></li><li><a href="RTMSuccess.html">RTMSuccess</a><ul class='methods'><li data-type='method'><a href="RTMSuccess.html#toString">toString</a></li></ul></li><li><a href="RTMTask.html">RTMTask</a></li><li><a href="RTMUser.html">RTMUser</a><ul class='methods'><li data-type='method'><a href="RTMUser.html#clearTaskIndexCache">clearTaskIndexCache</a></li><li data-type='method'><a href="RTMUser.html#get">get</a></li><li data-type='method'><a href="RTMUser.html#verifyAuthToken">verifyAuthToken</a></li><li data-type='method'><a href="RTMUser.html#~lists/add">lists/add</a></li><li data-type='method'><a href="RTMUser.html#~lists/archive">lists/archive</a></li><li data-type='method'><a href="RTMUser.html#~lists/get">lists/get</a></li><li data-type='method'><a href="RTMUser.html#~lists/remove">lists/remove</a></li><li data-type='method'><a href="RTMUser.html#~lists/rename">lists/rename</a></li><li data-type='method'><a href="RTMUser.html#~tasks/add">tasks/add</a></li><li data-type='method'><a href="RTMUser.html#~tasks/addNotes">tasks/addNotes</a></li><li data-type='method'><a href="RTMUser.html#~tasks/addTags">tasks/addTags</a></li><li data-type='method'><a href="RTMUser.html#~tasks/complete">tasks/complete</a></li><li data-type='method'><a href="RTMUser.html#~tasks/decreasePriority">tasks/decreasePriority</a></li><li data-type='method'><a href="RTMUser.html#~tasks/get">tasks/get</a></li><li data-type='method'><a href="RTMUser.html#~tasks/getTask">tasks/getTask</a></li><li data-type='method'><a href="RTMUser.html#~tasks/increasePriority">tasks/increasePriority</a></li><li data-type='method'><a href="RTMUser.html#~tasks/move">tasks/move</a></li><li data-type='method'><a href="RTMUser.html#~tasks/postpone">tasks/postpone</a></li><li data-type='method'><a href="RTMUser.html#~tasks/priority">tasks/priority</a></li><li data-type='method'><a href="RTMUser.html#~tasks/remove">tasks/remove</a></li><li data-type='method'><a href="RTMUser.html#~tasks/removeTags">tasks/removeTags</a></li><li data-type='method'><a href="RTMUser.html#~tasks/setDueDate">tasks/setDueDate</a></li><li data-type='method'><a href="RTMUser.html#~tasks/setName">tasks/setName</a></li><li data-type='method'><a href="RTMUser.html#~tasks/setURL">tasks/setURL</a></li><li data-type='method'><a href="RTMUser.html#~tasks/uncomplete">tasks/uncomplete</a></li></ul></li></ul><h3>Global</h3><ul><li><a href="global.html#setStartDate">setStartDate</a></li></ul>
27
+ </nav>
28
+
29
+ <div id="main">
30
+
31
+
32
+
33
+
34
+
35
+
36
+
37
+
38
+
39
+
40
+
41
+
42
+
43
+
44
+
45
+
46
+
47
+
48
+
49
+ <section class="readme">
50
+ <article><h1>Remember The Milk API Interface</h1>
51
+ <p><strong>node module:</strong> <a href="https://www.npmjs.com/package/rtm-api">rtm-api</a><br>
52
+ <strong>GitHub repo:</strong> <a href="https://github.com/dwaring87/rtm-api">dwaring87/rtm-api</a></p>
53
+ <hr>
54
+ <p>This Node module provides a wrapper around the Remember the Milk API.</p>
55
+ <p>You will need your own RTM API Key and Secret, available from the Remember the
56
+ Milk <a href="https://www.rememberthemilk.com/services/api/keys.rtm">website</a>.</p>
57
+ <h2>Main Features</h2>
58
+ <ul>
59
+ <li>
60
+ <p>Two-step User Authorization procedure</p>
61
+ </li>
62
+ <li>
63
+ <p>Direct RTM API Requests</p>
64
+ </li>
65
+ </ul>
66
+ <pre class="prettyprint source lang-javascript"><code>// Requests are automatically signed and include the User's Auth Token
67
+ user.get('rtm.method', {param: 'value'}, function(err, response) {
68
+ if ( err ) {
69
+ return console.error(err.toString());
70
+ }
71
+ console.log(response);
72
+ });
73
+ </code></pre>
74
+ <ul>
75
+ <li>
76
+ <p>Basic Error Handling and Response Parsing</p>
77
+ </li>
78
+ <li>
79
+ <p>Per-User Rate Limiting (following RTM API guidelines)</p>
80
+ </li>
81
+ <li>
82
+ <p>Helper Classes and Functions for <strong>Lists</strong> and <strong>Tasks</strong></p>
83
+ </li>
84
+ </ul>
85
+ <pre class="prettyprint source lang-javascript"><code>// Optional filter selecting tasks with a priority of 1
86
+ user.tasks.get('priority:1', function(err, tasks) {
87
+ if ( err ) {
88
+ return console.error(err.toString());
89
+ }
90
+ tasks.forEach(function(task){
91
+ // task is an RTMTask instance
92
+ console.log(task.priority);
93
+ console.log(task.name);
94
+ });
95
+ });
96
+ </code></pre>
97
+ <h2>Installation</h2>
98
+ <p>This module can be installed via <code>npm</code>:</p>
99
+ <pre class="prettyprint source"><code>npm install rtm-api
100
+ </code></pre>
101
+ <p>or downloaded directly from the <a href="https://github.com/dwaring87/rtm-api">GitHub repository</a>.</p>
102
+ <h2>Documentation</h2>
103
+ <p>Full documentation is available in the <strong>/docs/</strong> directory of this repository or
104
+ online at <a href="https://dwaring87.github.io/rtm-api/">https://dwaring87.github.io/rtm-api/</a>.</p>
105
+ <p>Additional usage examples can be found in the repository's <a href="https://github.com/dwaring87/rtm-api/wiki">wiki pages</a>.</p>
106
+ <h2>Usage</h2>
107
+ <p>Set up your API credentials by specifying your API Key, API Secret and the
108
+ requested account permissions.</p>
109
+ <pre class="prettyprint source lang-javascript"><code>const RTM = require('rtm-api');
110
+ let client = new RTM('API_KEY', 'API_SECRET', RTM.PERM_DELETE); // An instance of RTMClient
111
+ </code></pre>
112
+ <p>Account permissions can be granted in one of three categories:</p>
113
+ <ul>
114
+ <li><strong>read</strong> – gives the ability to read task, contact, group and list details and contents.</li>
115
+ <li><strong>write</strong> – gives the ability to add and modify task, contact, group and list details and contents (also allows you to read).</li>
116
+ <li><strong>delete</strong> – gives the ability to delete tasks, contacts, groups and lists (also allows you to read and write).</li>
117
+ </ul>
118
+ <h3>User Authentication</h3>
119
+ <p>Almost all RTM API methods require an authorized user's Auth Token. This is
120
+ kept in the <code>RTMUser</code> class which can be instantiated manually if you already
121
+ have the User's information with a valid Auth Token:</p>
122
+ <pre class="prettyprint source lang-javascript"><code>let user = client.user.create(id, 'username', 'fullname', 'authToken');
123
+ </code></pre>
124
+ <p>Otherwise, an Auth Token can be obtained via the API using the steps outlined
125
+ in the following sections.</p>
126
+ <h4>Generate an Auth URL</h4>
127
+ <p>First, generate an Auth URL that the RTM User will open in their browser. This
128
+ will direct the RTM User to the Remember the Milk website where they will log in
129
+ and authorize this program to access their account.</p>
130
+ <pre class="prettyprint source lang-javascript"><code>// Get an RTM Auth URL that will ask the RTM User to grant access to your client
131
+ client.auth.getAuthUrl(function(err, authUrl, frob) {
132
+ if ( err ) {
133
+ return console.error(err.toString());
134
+ }
135
+
136
+ // Have the User open the authUrl
137
+ console.log(authUrl);
138
+
139
+ // Save the frob for the next step
140
+ ...
141
+
142
+ });
143
+ </code></pre>
144
+ <h4>Generate an Auth Token</h4>
145
+ <p>Once the RTM User has opened the <code>authUrl</code> and granted access to the program,
146
+ pass the <code>frob</code> from the first step to the <code>getAuthToken</code> function to
147
+ get an <code>RTMUser</code> with an Auth Token to be used in future API calls.</p>
148
+ <pre class="prettyprint source lang-javascript"><code>// Get an Auth Token for the User once they've authorized the frob
149
+ client.auth.getAuthToken(frob, function(err, user) {
150
+ if ( err ) {
151
+ return console.error(err.toString());
152
+ }
153
+
154
+ // If successful, the returned user will include the property `authToken`
155
+ console.log(user.authToken);
156
+
157
+ // Save the user for making authenticated API calls via user.get()
158
+
159
+ });
160
+ </code></pre>
161
+ <h4>Verify the Auth Token</h4>
162
+ <p>The Auth Token can be verified at any point using the <code>verifyAuthToken</code> function.</p>
163
+ <pre class="prettyprint source lang-javascript"><code>client.auth.verifyAuthToken(user.authToken, function(err, verified) {
164
+
165
+ // verified will be true if auth token can be used for API calls
166
+
167
+ });
168
+ </code></pre>
169
+ <h3>API Requests</h3>
170
+ <p>To make a request to the RTM API, a <a href="https://www.rememberthemilk.com/services/api/methods.rtm">method name</a>
171
+ and callback function are required.</p>
172
+ <p>If the RTM API method requires any parameters, they should be provided as
173
+ an object with the parameters set as key/value pairs. For example, if the
174
+ method requires the parameters: abc=foo and xyz=bar then they should be provided
175
+ as:</p>
176
+ <pre class="prettyprint source"><code>{
177
+ abc: &quot;foo&quot;,
178
+ xyz: &quot;bar&quot;
179
+ }
180
+ </code></pre>
181
+ <p>If the API Method does not require a User's Auth Token, the request can be made
182
+ using the <code>get</code> function available from the <code>RTMClient</code>.</p>
183
+ <pre class="prettyprint source lang-javascript"><code>client.get('rtm.auth.getFrob', function(err, resp) {
184
+ if ( err ) {
185
+ return console.error(err.toString());
186
+ }
187
+
188
+ // Handle the Response
189
+ console.log(resp.frob);
190
+ });
191
+ </code></pre>
192
+ <p>However, most API Methods will require a User's Auth Token. This can be provided
193
+ directly as an <code>auth_token</code> parameter or by calling the <code>get</code> function available
194
+ from the <code>RTMUser</code> instance, which will automatically provide the Auth Token.</p>
195
+ <pre class="prettyprint source lang-javascript"><code>let params = {
196
+ list_id: &quot;list id&quot;,
197
+ filter: &quot;tasks filter&quot;
198
+ };
199
+ user.get('rtm.tasks.getList', params, function(err, resp) {
200
+ if ( err ) {
201
+ return console.error(err.toString());
202
+ }
203
+
204
+ // Handle the Response
205
+ console.log(resp);
206
+ });
207
+ </code></pre>
208
+ <h3>API Responses</h3>
209
+ <p>The arguments returned in the callback of the <code>get</code> function will include an
210
+ <code>RTMError</code> instance (if the RTM API returned a status of 'fail') or an
211
+ <code>RTMSuccess</code> instance for successful requests.</p>
212
+ <h4>Error Responses</h4>
213
+ <p>An <code>RTMError</code> response will have <code>code</code> and <code>msg</code> properties set based on the
214
+ RTM API response.</p>
215
+ <p>Additional error codes are added by <code>rtm-api</code>:</p>
216
+ <table>
217
+ <thead>
218
+ <tr>
219
+ <th style="text-align:center">error code</th>
220
+ <th>error description</th>
221
+ </tr>
222
+ </thead>
223
+ <tbody>
224
+ <tr>
225
+ <td style="text-align:center">-1</td>
226
+ <td><strong>Network Error</strong>: <code>rtm-api</code> could not connect to the RTM API Server.</td>
227
+ </tr>
228
+ <tr>
229
+ <td style="text-align:center">-2</td>
230
+ <td><strong>Response Error</strong>: <code>rtm-api</code> could not parse the response from the RTM API Server.</td>
231
+ </tr>
232
+ <tr>
233
+ <td style="text-align:center">-3</td>
234
+ <td><strong>Reference Error</strong>: An <code>RTMTask</code> index is out of range or RTM item could not be found with the given reference.</td>
235
+ </tr>
236
+ <tr>
237
+ <td style="text-align:center">-4</td>
238
+ <td><strong>Rate Limit Error</strong>: The RTM User has reached the API request rate limit set by the RTM API Server.</td>
239
+ </tr>
240
+ <tr>
241
+ <td style="text-align:center">-5</td>
242
+ <td><strong>Server Error</strong>: <code>rtm-api</code> encountered a problem with the RTM API Server. Try the request again later.</td>
243
+ </tr>
244
+ </tbody>
245
+ </table>
246
+ <h4>Successful Responses</h4>
247
+ <p>For a successful response, the API response properties can be accessed directly
248
+ from the <code>RTMSuccess</code> properties (<code>resp.tasks</code>, <code>resp.tasks.list</code>, etc). All
249
+ response properties are available via <code>resp.props</code></p>
250
+ <h3>Helper Functions</h3>
251
+ <p><code>rtm-api</code> includes a number of helper classes &amp; functions for commonly used API
252
+ methods used to obtain and modify RTM Lists and Tasks. These functions are
253
+ available via an <code>RTMUser</code> instance's <code>lists</code> and <code>tasks</code> properties.</p>
254
+ <p>The following <strong>list</strong> functions are available:</p>
255
+ <ul>
256
+ <li><code>get()</code>: get an array of <code>RTMList</code>s</li>
257
+ <li><code>add()</code>: add a new List</li>
258
+ <li><code>archive()</code>: archive a List</li>
259
+ <li><code>rename()</code>: rename a List</li>
260
+ <li><code>remove()</code>: remove a List</li>
261
+ </ul>
262
+ <p>The following <strong>task</strong> functions are available:</p>
263
+ <ul>
264
+ <li><code>get()</code>: get an array of <code>RTMTasks</code>s (with the Tasks's <code>RTMList</code> added to the <code>list</code> property)</li>
265
+ <li><code>getTask()</code>: get a specific Task (specified by a Task Index)</li>
266
+ <li><code>add()</code>: add a new Task</li>
267
+ <li><code>remove()</code>: remove a Task</li>
268
+ <li><code>complete()</code>: mark a Task as completed</li>
269
+ <li><code>uncomplete()</code>: mark a Task as NOT completed</li>
270
+ <li><code>addTags()</code>: add one or tags to a Task</li>
271
+ <li><code>addNotes()</code>: add one or more notes to a Task</li>
272
+ <li><code>removeTags()</code>: remove one or more tags from a Task</li>
273
+ <li><code>priority()</code>: set the Priority of a Task</li>
274
+ <li><code>decreasePriority()</code>: decrease the Priority of a Task</li>
275
+ <li><code>increasePriority()</code>: increase the Priority of a Task</li>
276
+ <li><code>move()</code>: move a Task to a different List</li>
277
+ <li><code>setDueDate()</code>: set the due date of a Task</li>
278
+ <li><code>setStartDate()</code>: set the start date of a Task</li>
279
+ <li><code>postpone()</code>: postpone the due date of Task by one day</li>
280
+ <li><code>setName()</code>: set the name of a Task</li>
281
+ <li><code>setURL()</code>: set the URL of a Task</li>
282
+ </ul>
283
+ <p>See the <code>RTMUser</code> entry in the <strong>Documentation</strong> for more information on the
284
+ Helper Functions.</p>
285
+ <p>Examples using the helper functions can be found in the repository's
286
+ <a href="https://github.com/dwaring87/rtm-api/wiki">wiki pages</a>.</p></article>
287
+ </section>
288
+
289
+
290
+
291
+
292
+
293
+
294
+ </div>
295
+
296
+ <br class="clear">
297
+
298
+ <footer>
299
+ Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.11</a> on Mon Sep 05 2022 15:26:15 GMT-0400 (Eastern Daylight Time) using the <a href="https://github.com/dwaring87/docdash">@dwaring87/docdash</a> theme.
300
+ </footer>
301
+
302
+ <script>prettyPrint();</script>
303
+ <script src="scripts/linenumber.js"></script>
304
+ </body>
305
+ </html>
@@ -0,0 +1,159 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <title>list/index.js - Documentation</title>
6
+
7
+ <script src="scripts/prettify/prettify.js"></script>
8
+ <script src="scripts/prettify/lang-css.js"></script>
9
+ <!--[if lt IE 9]>
10
+ <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
11
+ <![endif]-->
12
+ <link type="text/css" rel="stylesheet" href="styles/prettify.css">
13
+ <link type="text/css" rel="stylesheet" href="styles/jsdoc.css">
14
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
15
+ </head>
16
+ <body>
17
+
18
+ <input type="checkbox" id="nav-trigger" class="nav-trigger" />
19
+ <label for="nav-trigger" class="navicon-button x">
20
+ <div class="navicon"></div>
21
+ </label>
22
+
23
+ <label for="nav-trigger" class="overlay"></label>
24
+
25
+ <nav>
26
+ <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="RTMClient.html">RTMClient</a><ul class='methods'><li data-type='method'><a href="RTMClient.html#get">get</a></li><li data-type='method'><a href="RTMClient.html#~auth/getAuthToken">auth/getAuthToken</a></li><li data-type='method'><a href="RTMClient.html#~auth/getAuthUrl">auth/getAuthUrl</a></li><li data-type='method'><a href="RTMClient.html#~auth/verifyAuthToken">auth/verifyAuthToken</a></li><li data-type='method'><a href="RTMClient.html#~user/create">user/create</a></li><li data-type='method'><a href="RTMClient.html#~user/export">user/export</a></li><li data-type='method'><a href="RTMClient.html#~user/exportToString">user/exportToString</a></li><li data-type='method'><a href="RTMClient.html#~user/import">user/import</a></li><li data-type='method'><a href="RTMClient.html#~user/importFromString">user/importFromString</a></li></ul></li><li><a href="RTMError.html">RTMError</a><ul class='methods'><li data-type='method'><a href="RTMError.html#.networkError">networkError</a></li><li data-type='method'><a href="RTMError.html#.rateLimitError">rateLimitError</a></li><li data-type='method'><a href="RTMError.html#.referenceError">referenceError</a></li><li data-type='method'><a href="RTMError.html#.responseError">responseError</a></li><li data-type='method'><a href="RTMError.html#.serverError">serverError</a></li><li data-type='method'><a href="RTMError.html#toString">toString</a></li></ul></li><li><a href="RTMList.html">RTMList</a></li><li><a href="RTMResponse.html">RTMResponse</a><ul class='methods'><li data-type='method'><a href="RTMResponse.html#has">has</a></li><li data-type='method'><a href="RTMResponse.html#toString">toString</a></li></ul></li><li><a href="RTMSuccess.html">RTMSuccess</a><ul class='methods'><li data-type='method'><a href="RTMSuccess.html#toString">toString</a></li></ul></li><li><a href="RTMTask.html">RTMTask</a></li><li><a href="RTMUser.html">RTMUser</a><ul class='methods'><li data-type='method'><a href="RTMUser.html#clearTaskIndexCache">clearTaskIndexCache</a></li><li data-type='method'><a href="RTMUser.html#get">get</a></li><li data-type='method'><a href="RTMUser.html#verifyAuthToken">verifyAuthToken</a></li><li data-type='method'><a href="RTMUser.html#~lists/add">lists/add</a></li><li data-type='method'><a href="RTMUser.html#~lists/archive">lists/archive</a></li><li data-type='method'><a href="RTMUser.html#~lists/get">lists/get</a></li><li data-type='method'><a href="RTMUser.html#~lists/remove">lists/remove</a></li><li data-type='method'><a href="RTMUser.html#~lists/rename">lists/rename</a></li><li data-type='method'><a href="RTMUser.html#~tasks/add">tasks/add</a></li><li data-type='method'><a href="RTMUser.html#~tasks/addNotes">tasks/addNotes</a></li><li data-type='method'><a href="RTMUser.html#~tasks/addTags">tasks/addTags</a></li><li data-type='method'><a href="RTMUser.html#~tasks/complete">tasks/complete</a></li><li data-type='method'><a href="RTMUser.html#~tasks/decreasePriority">tasks/decreasePriority</a></li><li data-type='method'><a href="RTMUser.html#~tasks/get">tasks/get</a></li><li data-type='method'><a href="RTMUser.html#~tasks/getTask">tasks/getTask</a></li><li data-type='method'><a href="RTMUser.html#~tasks/increasePriority">tasks/increasePriority</a></li><li data-type='method'><a href="RTMUser.html#~tasks/move">tasks/move</a></li><li data-type='method'><a href="RTMUser.html#~tasks/postpone">tasks/postpone</a></li><li data-type='method'><a href="RTMUser.html#~tasks/priority">tasks/priority</a></li><li data-type='method'><a href="RTMUser.html#~tasks/remove">tasks/remove</a></li><li data-type='method'><a href="RTMUser.html#~tasks/removeTags">tasks/removeTags</a></li><li data-type='method'><a href="RTMUser.html#~tasks/setDueDate">tasks/setDueDate</a></li><li data-type='method'><a href="RTMUser.html#~tasks/setName">tasks/setName</a></li><li data-type='method'><a href="RTMUser.html#~tasks/setURL">tasks/setURL</a></li><li data-type='method'><a href="RTMUser.html#~tasks/uncomplete">tasks/uncomplete</a></li></ul></li></ul><h3>Global</h3><ul><li><a href="global.html#setStartDate">setStartDate</a></li></ul>
27
+ </nav>
28
+
29
+ <div id="main">
30
+
31
+ <h1 class="page-title">list/index.js</h1>
32
+
33
+
34
+
35
+
36
+
37
+
38
+
39
+ <section>
40
+ <article>
41
+ <pre class="prettyprint source linenums"><code>'use strict';
42
+
43
+
44
+ /**
45
+ * ### RTM List
46
+ *
47
+ * This Class is used to represent the properties of an RTM List.
48
+ *
49
+ * All of the list properties from RTM are directly accessible from this Class.
50
+ *
51
+ * ```
52
+ * let list = new RTMList(...);
53
+ * let name = list.name;
54
+ * ```
55
+ * @class
56
+ */
57
+ class RTMList {
58
+
59
+ /**
60
+ * Create a new RTM List
61
+ * @param {object} props The properties from the RTM API response `resp.lists.list`
62
+ */
63
+ constructor(props) {
64
+
65
+ /**
66
+ * List ID
67
+ * @type {Number}
68
+ */
69
+ this.id = parseFloat(props.id);
70
+
71
+ /**
72
+ * List Name
73
+ * @type {string}
74
+ */
75
+ this.name = props.name;
76
+
77
+ /**
78
+ * List Deleted Flag
79
+ * @type {boolean}
80
+ */
81
+ this.deleted = props.deleted.toString() === '1';
82
+
83
+ /**
84
+ * List Locked Flag
85
+ * @type {boolean}
86
+ */
87
+ this.locked = props.locked.toString() === '1';
88
+
89
+ /**
90
+ * List Archived Flag
91
+ * @type {boolean}
92
+ */
93
+ this.archived = props.archived.toString() === '1';
94
+
95
+ /**
96
+ * List Position
97
+ * @type {Number}
98
+ */
99
+ this.position = parseInt(props.position);
100
+
101
+ /**
102
+ * Smart List Flag
103
+ * @type {boolean}
104
+ */
105
+ this.smart = props.smart.toString() === '1';
106
+ if ( this.smart ) {
107
+
108
+ /**
109
+ * Smart List Filter
110
+ * @type {string}
111
+ */
112
+ this.filter = props.filter;
113
+
114
+ }
115
+
116
+ /**
117
+ * List Sort Order
118
+ * @type {Number}
119
+ */
120
+ this.sort_order = parseInt(props.sort_order);
121
+
122
+ }
123
+
124
+ /**
125
+ * All of the RTM List properties
126
+ * @type {object}
127
+ */
128
+ get props() {
129
+ let rtn = {};
130
+ for ( let key in this ) {
131
+ if ( this.hasOwnProperty(key) &amp;&amp; key !== '_index' ) {
132
+ rtn[key] = this[key];
133
+ }
134
+ }
135
+ return rtn;
136
+ }
137
+
138
+ }
139
+
140
+
141
+ module.exports = RTMList;</code></pre>
142
+ </article>
143
+ </section>
144
+
145
+
146
+
147
+
148
+ </div>
149
+
150
+ <br class="clear">
151
+
152
+ <footer>
153
+ Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.11</a> on Mon Sep 05 2022 15:26:15 GMT-0400 (Eastern Daylight Time) using the <a href="https://github.com/dwaring87/docdash">@dwaring87/docdash</a> theme.
154
+ </footer>
155
+
156
+ <script>prettyPrint();</script>
157
+ <script src="scripts/linenumber.js"></script>
158
+ </body>
159
+ </html>
@@ -0,0 +1,172 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <title>response/error.js - Documentation</title>
6
+
7
+ <script src="scripts/prettify/prettify.js"></script>
8
+ <script src="scripts/prettify/lang-css.js"></script>
9
+ <!--[if lt IE 9]>
10
+ <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
11
+ <![endif]-->
12
+ <link type="text/css" rel="stylesheet" href="styles/prettify.css">
13
+ <link type="text/css" rel="stylesheet" href="styles/jsdoc.css">
14
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
15
+ </head>
16
+ <body>
17
+
18
+ <input type="checkbox" id="nav-trigger" class="nav-trigger" />
19
+ <label for="nav-trigger" class="navicon-button x">
20
+ <div class="navicon"></div>
21
+ </label>
22
+
23
+ <label for="nav-trigger" class="overlay"></label>
24
+
25
+ <nav>
26
+ <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="RTMClient.html">RTMClient</a><ul class='methods'><li data-type='method'><a href="RTMClient.html#get">get</a></li><li data-type='method'><a href="RTMClient.html#~auth/getAuthToken">auth/getAuthToken</a></li><li data-type='method'><a href="RTMClient.html#~auth/getAuthUrl">auth/getAuthUrl</a></li><li data-type='method'><a href="RTMClient.html#~auth/verifyAuthToken">auth/verifyAuthToken</a></li><li data-type='method'><a href="RTMClient.html#~user/create">user/create</a></li><li data-type='method'><a href="RTMClient.html#~user/export">user/export</a></li><li data-type='method'><a href="RTMClient.html#~user/exportToString">user/exportToString</a></li><li data-type='method'><a href="RTMClient.html#~user/import">user/import</a></li><li data-type='method'><a href="RTMClient.html#~user/importFromString">user/importFromString</a></li></ul></li><li><a href="RTMError.html">RTMError</a><ul class='methods'><li data-type='method'><a href="RTMError.html#.networkError">networkError</a></li><li data-type='method'><a href="RTMError.html#.rateLimitError">rateLimitError</a></li><li data-type='method'><a href="RTMError.html#.referenceError">referenceError</a></li><li data-type='method'><a href="RTMError.html#.responseError">responseError</a></li><li data-type='method'><a href="RTMError.html#.serverError">serverError</a></li><li data-type='method'><a href="RTMError.html#toString">toString</a></li></ul></li><li><a href="RTMList.html">RTMList</a></li><li><a href="RTMResponse.html">RTMResponse</a><ul class='methods'><li data-type='method'><a href="RTMResponse.html#has">has</a></li><li data-type='method'><a href="RTMResponse.html#toString">toString</a></li></ul></li><li><a href="RTMSuccess.html">RTMSuccess</a><ul class='methods'><li data-type='method'><a href="RTMSuccess.html#toString">toString</a></li></ul></li><li><a href="RTMTask.html">RTMTask</a></li><li><a href="RTMUser.html">RTMUser</a><ul class='methods'><li data-type='method'><a href="RTMUser.html#clearTaskIndexCache">clearTaskIndexCache</a></li><li data-type='method'><a href="RTMUser.html#get">get</a></li><li data-type='method'><a href="RTMUser.html#verifyAuthToken">verifyAuthToken</a></li><li data-type='method'><a href="RTMUser.html#~lists/add">lists/add</a></li><li data-type='method'><a href="RTMUser.html#~lists/archive">lists/archive</a></li><li data-type='method'><a href="RTMUser.html#~lists/get">lists/get</a></li><li data-type='method'><a href="RTMUser.html#~lists/remove">lists/remove</a></li><li data-type='method'><a href="RTMUser.html#~lists/rename">lists/rename</a></li><li data-type='method'><a href="RTMUser.html#~tasks/add">tasks/add</a></li><li data-type='method'><a href="RTMUser.html#~tasks/addNotes">tasks/addNotes</a></li><li data-type='method'><a href="RTMUser.html#~tasks/addTags">tasks/addTags</a></li><li data-type='method'><a href="RTMUser.html#~tasks/complete">tasks/complete</a></li><li data-type='method'><a href="RTMUser.html#~tasks/decreasePriority">tasks/decreasePriority</a></li><li data-type='method'><a href="RTMUser.html#~tasks/get">tasks/get</a></li><li data-type='method'><a href="RTMUser.html#~tasks/getTask">tasks/getTask</a></li><li data-type='method'><a href="RTMUser.html#~tasks/increasePriority">tasks/increasePriority</a></li><li data-type='method'><a href="RTMUser.html#~tasks/move">tasks/move</a></li><li data-type='method'><a href="RTMUser.html#~tasks/postpone">tasks/postpone</a></li><li data-type='method'><a href="RTMUser.html#~tasks/priority">tasks/priority</a></li><li data-type='method'><a href="RTMUser.html#~tasks/remove">tasks/remove</a></li><li data-type='method'><a href="RTMUser.html#~tasks/removeTags">tasks/removeTags</a></li><li data-type='method'><a href="RTMUser.html#~tasks/setDueDate">tasks/setDueDate</a></li><li data-type='method'><a href="RTMUser.html#~tasks/setName">tasks/setName</a></li><li data-type='method'><a href="RTMUser.html#~tasks/setURL">tasks/setURL</a></li><li data-type='method'><a href="RTMUser.html#~tasks/uncomplete">tasks/uncomplete</a></li></ul></li></ul><h3>Global</h3><ul><li><a href="global.html#setStartDate">setStartDate</a></li></ul>
27
+ </nav>
28
+
29
+ <div id="main">
30
+
31
+ <h1 class="page-title">response/error.js</h1>
32
+
33
+
34
+
35
+
36
+
37
+
38
+
39
+ <section>
40
+ <article>
41
+ <pre class="prettyprint source linenums"><code>'use strict';
42
+
43
+ const RTMResponse = require('./response.js');
44
+
45
+
46
+ /**
47
+ * ### RTM Error Response
48
+ *
49
+ * This Class represents a failed request to the RTM API Server: the
50
+ * RTM API Server returned a response with a status of 'fail'. This
51
+ * Class will include the error code and error message from the
52
+ * response.
53
+ *
54
+ * `RTMError` extends {@link RTMResponse}
55
+ * @class
56
+ * @alias RTMError
57
+ */
58
+ class RTMError extends RTMResponse{
59
+
60
+ /**
61
+ * Create a new RTM Error Response
62
+ * @param {number} code Error Code
63
+ * @param {string} msg Error Message
64
+ * @constructor
65
+ */
66
+ constructor(code, msg) {
67
+ super(RTMResponse.STATUS_FAIL);
68
+ this._code = parseInt(code);
69
+ this._msg = msg;
70
+ }
71
+
72
+ /**
73
+ * The RTM Error Code
74
+ * @type {number}
75
+ */
76
+ get code() {
77
+ return this._code;
78
+ }
79
+
80
+ /**
81
+ * The RTM Error Message
82
+ * @type {string}
83
+ */
84
+ get msg() {
85
+ return this._msg;
86
+ }
87
+
88
+ /**
89
+ * Get a String representation of the Error
90
+ * @returns {string}
91
+ */
92
+ toString() {
93
+ return super.toString() + " ERROR " + this._code + ": " + this._msg;
94
+ }
95
+
96
+ }
97
+
98
+
99
+ // === CUSTOM ERRORS ==== //
100
+
101
+ /**
102
+ * Create a new `RTMError` that represents a network error.
103
+ *
104
+ * Error Code: `-1`
105
+ * @returns {RTMError}
106
+ */
107
+ RTMError.networkError = function() {
108
+ return new RTMError(-1, "Network Error: Could not make request to RTM API Server");
109
+ };
110
+
111
+ /**
112
+ * Create a new `RTMError` that represents an API response error.
113
+ *
114
+ * Error Code: `-2`
115
+ * @returns {RTMError}
116
+ */
117
+ RTMError.responseError = function() {
118
+ return new RTMError(-2, "Response Error: Could not parse the response from the RTM API Server");
119
+ };
120
+
121
+ /**
122
+ * Create a new `RTMError` that represents an index error (ie, task index is out
123
+ * of range).
124
+ *
125
+ * Error Code: `-3`
126
+ * @returns {RTMError}
127
+ */
128
+ RTMError.referenceError = function() {
129
+ return new RTMError(-3, "Reference Error: Could not find item by reference index number or name");
130
+ };
131
+
132
+ /**
133
+ * Create a new `RTMError` that represents an RTM API Rate Limit (the RTM API
134
+ * returned a HTTP Status code of `503`).
135
+ *
136
+ * Error Code: `-4`
137
+ * @returns {RTMError}
138
+ */
139
+ RTMError.rateLimitError = function() {
140
+ return new RTMError(-4, "Rate Limit Error: Your Account has temporarily reached the RTM API Rate Limit. Please wait a minute and try the request again later.");
141
+ };
142
+
143
+ /**
144
+ * Create a new `RTMError` that represents an RTM API Server Error (the RTM API
145
+ * returned a HTTP Status code of `5xx` - excluding `503`).
146
+ *
147
+ * Error Code: `-5`
148
+ * @returns {RTMError}
149
+ */
150
+ RTMError.serverError = function() {
151
+ return new RTMError(-5, "RTM API Server Error: The RTM API Server is not responding. Please try the request again later.");
152
+ };
153
+
154
+ module.exports = RTMError;</code></pre>
155
+ </article>
156
+ </section>
157
+
158
+
159
+
160
+
161
+ </div>
162
+
163
+ <br class="clear">
164
+
165
+ <footer>
166
+ Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.11</a> on Mon Sep 05 2022 15:26:15 GMT-0400 (Eastern Daylight Time) using the <a href="https://github.com/dwaring87/docdash">@dwaring87/docdash</a> theme.
167
+ </footer>
168
+
169
+ <script>prettyPrint();</script>
170
+ <script src="scripts/linenumber.js"></script>
171
+ </body>
172
+ </html>