-
Notifications
You must be signed in to change notification settings - Fork 338
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(zendesk): add delete user action
- Loading branch information
1 parent
43d741c
commit c12cfec
Showing
3 changed files
with
49 additions
and
0 deletions.
There are no files selected for viewing
43 changes: 43 additions & 0 deletions
43
packages/backend/src/apps/zendesk/actions/delete-user/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import defineAction from '../../../../helpers/define-action'; | ||
|
||
export default defineAction({ | ||
name: 'Delete user', | ||
key: 'deleteUser', | ||
description: 'Deletes an existing user.', | ||
arguments: [ | ||
{ | ||
label: 'User', | ||
key: 'userId', | ||
type: 'dropdown' as const, | ||
required: true, | ||
variables: true, | ||
description: 'Select the user you want to modify.', | ||
source: { | ||
type: 'query', | ||
name: 'getDynamicData', | ||
arguments: [ | ||
{ | ||
name: 'key', | ||
value: 'listUsers', | ||
}, | ||
{ | ||
name: 'parameters.showUserRole', | ||
value: 'true', | ||
}, | ||
{ | ||
name: 'parameters.includeAllUsers', | ||
value: 'true', | ||
}, | ||
], | ||
}, | ||
}, | ||
], | ||
|
||
async run($) { | ||
const userId = $.step.parameters.userId; | ||
|
||
const response = await $.http.delete(`/api/v2/users/${userId}`); | ||
|
||
$.setActionItem({ raw: response.data }); | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,19 @@ | ||
import createTicket from './create-ticket'; | ||
import createUser from './create-user'; | ||
import deleteTicket from './delete-ticket'; | ||
import deleteUser from './delete-user'; | ||
import findTicket from './find-ticket'; | ||
import findUser from './find-user'; | ||
import updateTicket from './update-ticket'; | ||
import updateUser from './update-user'; | ||
|
||
export default [ | ||
createTicket, | ||
createUser, | ||
deleteTicket, | ||
deleteUser, | ||
findTicket, | ||
findUser, | ||
updateTicket, | ||
updateUser, | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters