@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,208 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <title>user/lists.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">user/lists.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 errors = require('../response/error.js');
44
+ const _lists = require('../list/helper.js');
45
+
46
+
47
+ /**
48
+ * This module returns the RTM list-related functions for the RTMUser
49
+ * @param {RTMUser} user RTM User instance
50
+ * @returns {{get: function, update: function, add: function, remove: function, rename: function, archive: function}}
51
+ * @private
52
+ */
53
+ module.exports = function(user) {
54
+ let rtn = {};
55
+
56
+ /**
57
+ * Get the list of RTM Lists for this User from the API Server
58
+ * @param {function} callback Callback function(err, lists)
59
+ * @param {RTMError} callback.err RTM API Error Response, if encountered
60
+ * @param {RTMList[]} callback.lists List of User's RTM Lists
61
+ * @function RTMUser~lists/get
62
+ */
63
+ rtn.get = function(callback) {
64
+ _lists.get(user, callback);
65
+ };
66
+
67
+ /**
68
+ * Add a new RTM List for this User
69
+ * @param {string} name Name of the new RTM List
70
+ * @param {string} [filter] Smart List Filter
71
+ * @param {function} callback Callback function(err, lists)
72
+ * @param {RTMError} callback.err RTM API Error Response, if encountered
73
+ * @function RTMUser~lists/add
74
+ */
75
+ rtn.add = function(name, filter, callback) {
76
+ if ( callback === undefined &amp;&amp; typeof filter === 'function' ) {
77
+ callback = filter;
78
+ filter = undefined;
79
+ }
80
+ _lists.add(name, filter, user, callback);
81
+ };
82
+
83
+ /**
84
+ * Remove the specified RTM List for this User
85
+ * @param {string} name RTM List Name
86
+ * @param {function} callback Callback function(err)
87
+ * @param {RTMError} callback.err RTM API Error Response, if encountered
88
+ * @function RTMUser~lists/remove
89
+ */
90
+ rtn.remove = function(name, callback) {
91
+
92
+ // Get the User's Lists
93
+ _lists.get(user, function(err, lists) {
94
+ if ( err ) {
95
+ return callback(err);
96
+ }
97
+
98
+ // Find the matching list IDs
99
+ let ids = [];
100
+ for ( let i = 0; i &lt; lists.length; i++ ) {
101
+ if ( lists[i].name.toLowerCase() === name.toLowerCase() ) {
102
+ ids.push(lists[i].id);
103
+ }
104
+ }
105
+
106
+ // Remove the matching List
107
+ if ( ids.length === 1 ) {
108
+ return _lists.remove(ids[0], user, callback);
109
+ }
110
+ else {
111
+ return callback(errors.referenceError());
112
+ }
113
+
114
+ });
115
+
116
+ };
117
+
118
+ /**
119
+ * Rename the specified RTM List for this User
120
+ * @param {string} oldName Old RTM List Name
121
+ * @param {string} newName New RTM List name
122
+ * @param {function} callback Callback function(err)
123
+ * @param {RTMError} callback.err RTM API Error Response, if encountered
124
+ * @function RTMUser~lists/rename
125
+ */
126
+ rtn.rename = function(oldName, newName, callback) {
127
+
128
+ // Get the User's Lists
129
+ _lists.get(user, function(err, lists) {
130
+ if ( err ) {
131
+ return callback(err);
132
+ }
133
+
134
+ // Find the matching list IDs
135
+ let ids = [];
136
+ for ( let i = 0; i &lt; lists.length; i++ ) {
137
+ if ( lists[i].name.toLowerCase() === oldName.toLowerCase() ) {
138
+ ids.push(lists[i].id);
139
+ }
140
+ }
141
+
142
+ // Rename the matching List
143
+ if ( ids.length === 1 ) {
144
+ return _lists.rename(ids[0], newName, user, callback);
145
+ }
146
+ else {
147
+ return callback(errors.referenceError());
148
+ }
149
+
150
+ });
151
+
152
+ };
153
+
154
+ /**
155
+ * Archive the specified RTM List for this User
156
+ * @param {string} name RTM List Name
157
+ * @param {function} callback Callback function(err)
158
+ * @param {RTMError} callback.err RTM API Error Response, if encountered
159
+ * @function RTMUser~lists/archive
160
+ */
161
+ rtn.archive = function(name, callback) {
162
+
163
+ // Get the User's Lists
164
+ _lists.get(user, function(err, lists) {
165
+ if ( err ) {
166
+ return callback(err);
167
+ }
168
+
169
+ // Find the matching list IDs
170
+ let ids = [];
171
+ for ( let i = 0; i &lt; lists.length; i++ ) {
172
+ if ( lists[i].name.toLowerCase() === name.toLowerCase() ) {
173
+ ids.push(lists[i].id);
174
+ }
175
+ }
176
+
177
+ // Remove the matching List
178
+ if ( ids.length === 1 ) {
179
+ return _lists.archive(ids[0], user, callback);
180
+ }
181
+ else {
182
+ return callback(errors.referenceError());
183
+ }
184
+
185
+ });
186
+
187
+ };
188
+
189
+ return rtn;
190
+ };</code></pre>
191
+ </article>
192
+ </section>
193
+
194
+
195
+
196
+
197
+ </div>
198
+
199
+ <br class="clear">
200
+
201
+ <footer>
202
+ 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.
203
+ </footer>
204
+
205
+ <script>prettyPrint();</script>
206
+ <script src="scripts/linenumber.js"></script>
207
+ </body>
208
+ </html>