@mapcreator/api 2.6.0 → 2.6.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mapcreator/api",
3
- "version": "2.6.0",
3
+ "version": "2.6.1",
4
4
  "description": "Mapcreator JavaScript API",
5
5
  "main": "dist/bundle.js",
6
6
  "repository": "https://gitlab.com/mapcreator/api-wrapper.git",
@@ -103,11 +103,20 @@ export default class User extends CrudBase {
103
103
  }
104
104
 
105
105
  /**
106
- * Get the list messagse linked to the user
107
- * @returns {SimpleResourceProxy} - A proxy for accessing the resource
106
+ * Get a list of read/unread messages for the user
107
+ * @returns {CancelablePromise<{read: Message[], unread: Message[]}>} - Read and unread messages
108
108
  */
109
- get messages () {
110
- return this._proxyResourceList(Message);
109
+ messages () {
110
+ const url = `${this.url}/messages`;
111
+
112
+ return makeCancelable(async signal => {
113
+ const { data } = await this.api.ky.get(url, { signal }).json();
114
+
115
+ return {
116
+ read: data.read.map(o => new Message(this.api, o)),
117
+ unread: data.unread.map(o => new Message(this.api, o)),
118
+ };
119
+ });
111
120
  }
112
121
 
113
122
  /**