Skip to content

Commit 5dfbdfd

Browse files
authored
Merge pull request #19 from myDevicesIoT/feat/gdpr
Feat/gdpr
2 parents 305fc56 + 003ad10 commit 5dfbdfd

File tree

4 files changed

+109
-11
lines changed

4 files changed

+109
-11
lines changed

lib/Services/cayenne.js

Lines changed: 64 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,16 @@ class Cayenne extends Request {
109109
* @param {string} applicationId
110110
* @param {string} userId
111111
*/
112+
deleteThings(applicationId, userId) {
113+
const path = `/things`;
114+
const query = this.setTenant(applicationId, userId);
115+
116+
return this.send('DELETE', path, { query });
117+
}
118+
119+
/**
120+
* @param {String} userId
121+
*/
112122
destroyUser(applicationId, userId) {
113123
const path = `/things`;
114124
const query = this.setTenant(applicationId, userId);
@@ -151,6 +161,17 @@ class Cayenne extends Request {
151161
return this.send('GET', path, { query });
152162
}
153163

164+
/**
165+
* Delete all groups and attributes for a user
166+
* @param {string} applicationId
167+
* @param {string} userId The user id of the user that owns the parent device
168+
*/
169+
deleteGroups(applicationId, userId) {
170+
const path = `/things/groups`;
171+
const query = this.setTenant(applicationId, userId);
172+
return this.send('DELETE', path, { query });
173+
}
174+
154175
/**
155176
* Update an attribute group. Pass null to group_id to create a new group.
156177
* @param {string} applicationId
@@ -430,16 +451,6 @@ class Cayenne extends Request {
430451
return this.send('GET', path, { query });
431452
}
432453

433-
/**
434-
* Count V2 all things data types
435-
* @param {string} id
436-
* @param {Object} query
437-
*/
438-
countThingDataTypePropertiesV2(id, query) {
439-
const url = `/v2/things/datatypes/${id}/properties`;
440-
return this.send('GET', url, { query });
441-
}
442-
443454
/**
444455
* Create a V2 datatype property
445456
* @param {String} typeId
@@ -528,6 +539,17 @@ class Cayenne extends Request {
528539
: false
529540
});
530541
}
542+
543+
/**
544+
* Gets a device's meta data by device type id and meta id
545+
* @param {string} deviceTypeId
546+
* @param {string} id
547+
*/
548+
getOneDeviceTypeMeta(deviceTypeId, id) {
549+
const path = `/things/types/${deviceTypeId}/meta/${id}`;
550+
return this.send('GET', path);
551+
}
552+
531553
/**
532554
* Gets a device's meta data by device type id
533555
* @param {string} deviceTypeId
@@ -539,7 +561,7 @@ class Cayenne extends Request {
539561
getDeviceTypeMetaByKey(deviceTypeId, key, opts = {}) {
540562
opts = { useCache: false, cacheOnNotFound: false, ...opts };
541563

542-
const path = `/things/types/${deviceTypeId}/meta/${key}`;
564+
const path = `/things/types/${deviceTypeId}/meta/key/${key}`;
543565

544566
return this.send('GET', path, {
545567
cache: opts.useCache
@@ -564,6 +586,15 @@ class Cayenne extends Request {
564586
return this.send('GET', path);
565587
}
566588

589+
/**
590+
* Gets a device's channel meta by device type id
591+
* @param {string} deviceTypeId
592+
*/
593+
getDeviceTypeChannel(deviceTypeId, id) {
594+
const path = `/things/types/${deviceTypeId}/channels/${id}`;
595+
return this.send('GET', path);
596+
}
597+
567598
/**
568599
* Get a device type's uses
569600
* @param {string} deviceTypeId
@@ -573,6 +604,15 @@ class Cayenne extends Request {
573604
return this.send('GET', path);
574605
}
575606

607+
/**
608+
* Gets a device's uses by device type id
609+
* @param {string} deviceTypeId
610+
*/
611+
getDeviceTypeUse(deviceTypeId, id) {
612+
const path = `/things/types/${deviceTypeId}/uses/${id}`;
613+
return this.send('GET', path);
614+
}
615+
576616
/**
577617
* Creates a new device type
578618
* @param {Object} payload
@@ -844,6 +884,19 @@ class Cayenne extends Request {
844884

845885
return this.send('DELETE', path, { query });
846886
}
887+
888+
/**
889+
* Deletes fuses
890+
* @param {string} applicationId
891+
* @param {string} userId
892+
*/
893+
deleteFuses(applicationId, userId) {
894+
const path = `/fuses`;
895+
const query = this.setTenant(applicationId, userId);
896+
897+
return this.send('DELETE', path, { query });
898+
}
899+
847900
/**
848901
* @param {string} applicationId
849902
* @param {string} userId Owner of the fuse

lib/Services/executor.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,28 @@ class Executor extends Request {
8383
return this.send('DELETE', path, { query });
8484
}
8585

86+
/**
87+
* @param {string} applicationId
88+
* @param {String} userId
89+
*/
90+
deleteAllRules(applicationId, userId) {
91+
const path = `/rules`;
92+
const query = this.setTenant(applicationId, userId);
93+
94+
return this.send('DELETE', path, { query });
95+
}
96+
97+
/**
98+
* @param {string} applicationId
99+
* @param {String} userId
100+
*/
101+
deleteAllRulesLogs(applicationId, userId) {
102+
const path = `/rules-logs`;
103+
const query = this.setTenant(applicationId, userId);
104+
105+
return this.send('DELETE', path, { query });
106+
}
107+
86108
/**
87109
* @param {string} applicationId
88110
* @param {string} userId

lib/Services/hermes.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,18 @@ class Hermes extends Request {
7070
return this.send('GET', path, { query });
7171
}
7272

73+
/**
74+
* Destoy all notification logs for a user
75+
* @param {string} applicationId
76+
* @param {String} userId
77+
*/
78+
deleteLogs(applicationId, userId) {
79+
const path = `/logs`;
80+
const query = this.setTenant(applicationId, userId);
81+
82+
return this.send('DELETE', path, { query });
83+
}
84+
7385
/**
7486
* Gets email templates.
7587
* @param {string} applicationId

lib/Services/timekeeper.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,17 @@ class Timekeeper extends Request {
8484

8585
return this.send('DELETE', path, { query });
8686
}
87+
88+
/**
89+
* @param {string} applicationId
90+
* @param {string} userId
91+
*/
92+
deleteJobs(applicationId, userId) {
93+
const path = `/jobs`;
94+
const query = this.setTenant(applicationId, userId);
95+
96+
return this.send('DELETE', path, { query });
97+
}
8798
}
8899

89100
module.exports = Timekeeper;

0 commit comments

Comments
 (0)