File tree Expand file tree Collapse file tree 2 files changed +58
-2
lines changed
Expand file tree Collapse file tree 2 files changed +58
-2
lines changed Original file line number Diff line number Diff line change @@ -90,18 +90,47 @@ public function scrollUsers($options = [])
9090 /**
9191 * Deletes a single User based on the Intercom ID.
9292 *
93- * @see https://developers.intercom.com/reference#delete -a-user
93+ * @see https://developers.intercom.com/reference#archive -a-user
9494 * @param string $id
9595 * @param array $options
9696 * @return mixed
9797 * @throws \GuzzleHttp\Exception\GuzzleException
9898 */
99- public function deleteUser ($ id , $ options = [])
99+ public function archiveUser ($ id , $ options = [])
100100 {
101101 $ path = $ this ->userPath ($ id );
102102 return $ this ->client ->delete ($ path , $ options );
103103 }
104104
105+ /**
106+ * Deletes a single User based on the Intercom ID.
107+ *
108+ * @see https://developers.intercom.com/reference#archive-a-user
109+ * @param string $id
110+ * @param array $options
111+ * @return mixed
112+ * @throws \GuzzleHttp\Exception\GuzzleException
113+ */
114+ public function deleteUser ($ id , $ options = [])
115+ {
116+ return $ this ->archiveUser ($ id , $ options );
117+ }
118+
119+ /**
120+ * Permanently deletes a single User based on the Intercom ID.
121+ *
122+ * @see https://developers.intercom.com/reference#delete-users
123+ * @param string $id
124+ * @return mixed
125+ * @throws \GuzzleHttp\Exception\GuzzleException
126+ */
127+ public function permanentlyDeleteUser ($ id )
128+ {
129+ return $ this ->client ->post ('user_delete_requests ' , [
130+ 'intercom_user_id ' => $ id
131+ ]);
132+ }
133+
105134 /**
106135 * @param string $id
107136 * @return string
Original file line number Diff line number Diff line change @@ -36,4 +36,31 @@ public function testUserGet()
3636 $ users = new IntercomUsers ($ stub );
3737 $ this ->assertEquals ('foo ' , $ users ->getUsers ([]));
3838 }
39+
40+ public function testArchiveUser ()
41+ {
42+ $ stub = $ this ->getMockBuilder ('Intercom\IntercomClient ' )->disableOriginalConstructor ()->getMock ();
43+ $ stub ->method ('delete ' )->willReturn ('foo ' );
44+
45+ $ users = new IntercomUsers ($ stub );
46+ $ this ->assertEquals ('foo ' , $ users ->archiveUser ('' ));
47+ }
48+
49+ public function testDeleteUser ()
50+ {
51+ $ stub = $ this ->getMockBuilder ('Intercom\IntercomClient ' )->disableOriginalConstructor ()->getMock ();
52+ $ stub ->method ('delete ' )->willReturn ('foo ' );
53+
54+ $ users = new IntercomUsers ($ stub );
55+ $ this ->assertEquals ('foo ' , $ users ->deleteUser ('' ));
56+ }
57+
58+ public function testPermanentlyDeleteUser ()
59+ {
60+ $ stub = $ this ->getMockBuilder ('Intercom\IntercomClient ' )->disableOriginalConstructor ()->getMock ();
61+ $ stub ->method ('post ' )->willReturn ('foo ' );
62+
63+ $ users = new IntercomUsers ($ stub );
64+ $ this ->assertEquals ('foo ' , $ users ->permanentlyDeleteUser ('' ));
65+ }
3966}
You can’t perform that action at this time.
0 commit comments