Skip to content

Commit 21d47dd

Browse files
author
Patrick Walsh
committed
Adds delete user
1 parent cca3e88 commit 21d47dd

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

src/Particle.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,17 @@ class Particle {
221221
return this.delete('/v1/access_tokens/current', undefined, auth, context);
222222
}
223223

224+
/**
225+
* Delete the current user
226+
* @param {Object} options Options for this API call
227+
* @param {String} options.auth Access token
228+
* @param {String} options.password Password
229+
* @returns {Promise} A promise
230+
*/
231+
deleteUser({ auth, context, password }) {
232+
return this.delete('/v1/user', { password }, auth, context);
233+
}
234+
224235
/**
225236
* List all valid access tokens for a Particle Cloud account
226237
* @param {Object} options Options for this API call

test/Particle.spec.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2021,6 +2021,20 @@ describe('ParticleAPI', () => {
20212021
});
20222022
});
20232023
});
2024+
2025+
describe('.deleteUser', () => {
2026+
it('sends request to delete the current user', () => {
2027+
return api.deleteUser(props).then(result => {
2028+
result.should.match({
2029+
context: {},
2030+
data: { password: props.password },
2031+
method: 'delete',
2032+
uri: '/v1/user',
2033+
auth: props.auth
2034+
});
2035+
});
2036+
});
2037+
});
20242038
});
20252039

20262040
describe('backwards-compatibility function aliases', () => {

0 commit comments

Comments
 (0)