@@ -548,6 +548,27 @@ public function deactivateUsers($userIds)
548548 {
549549 return $ this ->start ()->uri ("/api/user/bulk " )
550550 ->urlParameter ("userId " , $ userIds )
551+ ->urlParameter ("dryRun " , false )
552+ ->urlParameter ("hardDelete " , false )
553+ ->delete ()
554+ ->go ();
555+ }
556+
557+ /**
558+ * Deactivates the users found with the given search query string.
559+ *
560+ * @param string $queryString The search query string.
561+ * @param boolean $dryRun Whether to preview or deactivate the users found by the queryString
562+ *
563+ * @return ClientResponse The ClientResponse.
564+ * @throws \Exception
565+ */
566+ public function deactivateUsersByQuery ($ queryString , $ dryRun )
567+ {
568+ return $ this ->start ()->uri ("/api/user/bulk " )
569+ ->urlParameter ("queryString " , $ queryString )
570+ ->urlParameter ("dryRun " , $ dryRun )
571+ ->urlParameter ("hardDelete " , false )
551572 ->delete ()
552573 ->go ();
553574 }
@@ -807,9 +828,11 @@ public function deleteUserActionReason($userActionReasonId)
807828 }
808829
809830 /**
810- * Deletes the users with the given ids.
831+ * Deletes the users with the given ids, or users matching the provided queryString.
832+ * If you provide both userIds and queryString, the userIds will be honored. This can be used to deactivate or hard-delete
833+ * a user based on the hardDelete request body parameter.
811834 *
812- * @param array $request The ids of the users to delete .
835+ * @param array $request The UserDeleteRequest .
813836 *
814837 * @return ClientResponse The ClientResponse.
815838 * @throws \Exception
@@ -822,6 +845,25 @@ public function deleteUsers($request)
822845 ->go ();
823846 }
824847
848+ /**
849+ * Delete the users found with the given search query string.
850+ *
851+ * @param string $queryString The search query string.
852+ * @param boolean $dryRun Whether to preview or delete the users found by the queryString
853+ *
854+ * @return ClientResponse The ClientResponse.
855+ * @throws \Exception
856+ */
857+ public function deleteUsersByQuery ($ queryString , $ dryRun )
858+ {
859+ return $ this ->start ()->uri ("/api/user/bulk " )
860+ ->urlParameter ("queryString " , $ queryString )
861+ ->urlParameter ("dryRun " , $ dryRun )
862+ ->urlParameter ("hardDelete " , true )
863+ ->delete ()
864+ ->go ();
865+ }
866+
825867 /**
826868 * Deletes the webhook for the given Id.
827869 *
0 commit comments