File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -206,6 +206,14 @@ public function deleteDnsZone(int $zoneId)
206206 $ this ->request ('delete ' , "/zones/ {$ zoneId }" );
207207 }
208208
209+ /**
210+ * Delete the given email identity.
211+ */
212+ public function deleteEmailIdentity (int $ identityId )
213+ {
214+ $ this ->request ('delete ' , "/email-identities/ {$ identityId }" );
215+ }
216+
209217 /**
210218 * Delete the given project.
211219 */
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ declare (strict_types=1 );
4+
5+ /*
6+ * This file is part of Ymir command-line tool.
7+ *
8+ * (c) Carl Alexander <support@ymirapp.com>
9+ *
10+ * For the full copyright and license information, please view the LICENSE
11+ * file that was distributed with this source code.
12+ */
13+
14+ namespace Ymir \Cli \Command \Email ;
15+
16+ use Symfony \Component \Console \Input \InputArgument ;
17+ use Symfony \Component \Console \Input \InputInterface ;
18+ use Ymir \Cli \Command \AbstractCommand ;
19+ use Ymir \Cli \Console \OutputStyle ;
20+
21+ class DeleteEmailIdentityCommand extends AbstractCommand
22+ {
23+ /**
24+ * The name of the command.
25+ *
26+ * @var string
27+ */
28+ public const NAME = 'email:identity:delete ' ;
29+
30+ /**
31+ * {@inheritdoc}
32+ */
33+ protected function configure ()
34+ {
35+ $ this
36+ ->setName (self ::NAME )
37+ ->addArgument ('identity ' , InputArgument::REQUIRED , 'The ID or name of the email identity to delete ' )
38+ ->setDescription ('Delete an existing email identity ' );
39+ }
40+
41+ /**
42+ * {@inheritdoc}
43+ */
44+ protected function perform (InputInterface $ input , OutputStyle $ output )
45+ {
46+ $ identity = $ this ->apiClient ->getEmailIdentity ($ this ->getStringArgument ($ input , 'identity ' ));
47+
48+ if ($ input ->isInteractive () && !$ output ->confirm ('Are you sure you want to delete this email identity? ' , false )) {
49+ return ;
50+ }
51+
52+ $ this ->apiClient ->deleteEmailIdentity ((int ) $ identity ['id ' ]);
53+
54+ $ output ->info ('Email identity deleted ' );
55+ }
56+ }
You can’t perform that action at this time.
0 commit comments