@beauraines/rtm-api 1.13.1 → 1.14.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.
@@ -21,7 +21,7 @@ jobs:
21
21
  - name: setup node
22
22
  uses: actions/setup-node@v3
23
23
  with:
24
- node-version: 18.x
24
+ node-version: 20.x
25
25
  registry-url: 'https://registry.npmjs.org'
26
26
  - name: npm install
27
27
  run: npm ci
package/CHANGELOG.md CHANGED
@@ -2,6 +2,21 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ### [1.14.1](https://github.com/beauraines/rtm-api/compare/v1.14.0...v1.14.1) (2025-12-19)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * adds Location functions to the user ([18322b7](https://github.com/beauraines/rtm-api/commit/18322b743419a7274e65d55780563198088cfd1d))
11
+
12
+ ## [1.14.0](https://github.com/beauraines/rtm-api/compare/v1.13.1...v1.14.0) (2025-12-19)
13
+
14
+
15
+ ### Features
16
+
17
+ * **Locations:** adds support. for get Locations ([4694b54](https://github.com/beauraines/rtm-api/commit/4694b54f8b6e4096dc235e83f83f8164c8f164c7))
18
+ * **Locations:** adds support. for get Locations ([#74](https://github.com/beauraines/rtm-api/issues/74)) ([76a6e05](https://github.com/beauraines/rtm-api/commit/76a6e059ad6717e43e64fb6f4584d2fbc9838d2e))
19
+
5
20
  ### [1.13.1](https://github.com/beauraines/rtm-api/compare/v1.13.0...v1.13.1) (2025-12-17)
6
21
 
7
22
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@beauraines/rtm-api",
3
- "version": "1.13.1",
3
+ "version": "1.14.1",
4
4
  "description": "Remember the Milk API Interface",
5
5
  "author": "David Waring <dev@davidwaring.net> (https://davidwaring.net)",
6
6
  "contributors": [
@@ -0,0 +1,39 @@
1
+ 'use strict';
2
+
3
+ const RTMLocation = require('./index.js');
4
+
5
+
6
+ /**
7
+ * API Call: rtm.locations.getList
8
+ * @param user RTMUser
9
+ * @param callback Callback function(err, locations)
10
+ * @private
11
+ */
12
+ function get(user, callback) {
13
+ user.get('rtm.locations.getList', function(err, resp) {
14
+ if ( err ) {
15
+ return callback(err);
16
+ }
17
+
18
+ // List of locations to return
19
+ let rtn = [];
20
+
21
+ // Parse each of the locations
22
+ let locations = resp.locations.location;
23
+ for ( let i = 0; i < locations.length; i++ ) {
24
+ rtn.push(
25
+ new RTMLocation(locations[i])
26
+ );
27
+ }
28
+
29
+ // Call the callback
30
+ return callback(null, rtn);
31
+ });
32
+ }
33
+
34
+
35
+
36
+
37
+ module.exports = {
38
+ get: get
39
+ };
@@ -0,0 +1,82 @@
1
+ 'use strict';
2
+
3
+
4
+ /**
5
+ * ### RTM Location
6
+ *
7
+ * This Class is used to represent the properties of an RTM Location.
8
+ *
9
+ * All of the location properties from RTM are directly accessible from this Class.
10
+ *
11
+ * ```
12
+ * let location = new RTMLocation(...);
13
+ * let name = location.name;
14
+ * ```
15
+ * @class
16
+ */
17
+ class RTMLocation {
18
+
19
+ /**
20
+ * Create a new RTM Location
21
+ * @param {object} props The properties from the RTM API response `resp.locations.location`
22
+ */
23
+ constructor(props) {
24
+
25
+ /**
26
+ * Location ID
27
+ * @type {Number}
28
+ */
29
+ this.id = parseFloat(props.id);
30
+
31
+ /**
32
+ * Location Name
33
+ * @type {string}
34
+ */
35
+ this.name = props.name;
36
+
37
+
38
+ /**
39
+ * Location Longitude
40
+ * @type {Number}
41
+ */
42
+ this.longitude = parseInt(props.longitude);
43
+
44
+ /**
45
+ * Location Latitude
46
+ * @type {Number}
47
+ */
48
+ this.latitude = parseInt(props.latitude);
49
+
50
+
51
+ /**
52
+ * Location Zoom
53
+ * @type {Number}
54
+ */
55
+ this.zoom = parseInt(props.zoom);
56
+
57
+ /**
58
+ * Location Address
59
+ * @type {string}
60
+ */
61
+ this.address = props.address;
62
+
63
+ }
64
+
65
+ /**
66
+ * All of the RTM Location properties
67
+ * @type {object}
68
+ */
69
+ get props() {
70
+ let rtn = {};
71
+ for ( let key in this ) {
72
+ if ( this.hasOwnProperty(key) && key !== '_index' ) {
73
+ rtn[key] = this[key];
74
+ }
75
+ }
76
+ return rtn;
77
+ }
78
+
79
+ }
80
+
81
+
82
+ module.exports = RTMLocation;
package/src/user/index.js CHANGED
@@ -259,6 +259,16 @@ class RTMUser {
259
259
  }
260
260
 
261
261
 
262
+ /**
263
+ * RTM Location related functions:
264
+ * - {@link RTMUser~locations/get|get}
265
+ * @returns {{get: function}}
266
+ */
267
+ get locations() {
268
+ return require('./locations.js')(this);
269
+ }
270
+
271
+
262
272
  /**
263
273
  * RTM Task related functions:
264
274
  * - {@link RTMUser~tasks/get|get}
@@ -0,0 +1,27 @@
1
+ 'use strict';
2
+
3
+ const _locations = require('../location/helper.js');
4
+
5
+
6
+ /**
7
+ * This module returns the RTM location-related functions for the RTMUser
8
+ * @param {RTMUser} user RTM User instance
9
+ * @returns {{get: function}}
10
+ * @private
11
+ */
12
+ module.exports = function(user) {
13
+ let rtn = {};
14
+
15
+ /**
16
+ * Get the list of RTM Lists for this User from the API Server
17
+ * @param {function} callback Callback function(err, lists)
18
+ * @param {RTMError} callback.err RTM API Error Response, if encountered
19
+ * @param {RTMList[]} callback.lists List of User's RTM Lists
20
+ * @function RTMUser~lists/get
21
+ */
22
+ rtn.get = function(callback) {
23
+ _locations.get(user, callback);
24
+ };
25
+
26
+ return rtn;
27
+ };