| @@ 46-94 (lines=49) @@ | ||
| 43 | * |
|
| 44 | * @package OCA\Circles\Command |
|
| 45 | */ |
|
| 46 | class CirclesDetails extends Base { |
|
| 47 | ||
| 48 | ||
| 49 | /** @var IL10N */ |
|
| 50 | private $l10n; |
|
| 51 | ||
| 52 | /** @var CirclesRequest */ |
|
| 53 | private $circlesRequest; |
|
| 54 | ||
| 55 | ||
| 56 | /** |
|
| 57 | * CirclesDetails constructor. |
|
| 58 | * |
|
| 59 | * @param IL10N $l10n |
|
| 60 | * @param CirclesRequest $circlesRequest |
|
| 61 | */ |
|
| 62 | public function __construct(IL10N $l10n, CirclesRequest $circlesRequest) { |
|
| 63 | parent::__construct(); |
|
| 64 | $this->l10n = $l10n; |
|
| 65 | $this->circlesRequest = $circlesRequest; |
|
| 66 | } |
|
| 67 | ||
| 68 | ||
| 69 | protected function configure() { |
|
| 70 | parent::configure(); |
|
| 71 | $this->setName('circles:manage:details') |
|
| 72 | ->setDescription('get details about a circle by its ID') |
|
| 73 | ->addArgument('circle_id', InputArgument::REQUIRED, 'ID of the circle'); |
|
| 74 | } |
|
| 75 | ||
| 76 | ||
| 77 | /** |
|
| 78 | * @param InputInterface $input |
|
| 79 | * @param OutputInterface $output |
|
| 80 | * |
|
| 81 | * @return int |
|
| 82 | * @throws CircleDoesNotExistException |
|
| 83 | */ |
|
| 84 | protected function execute(InputInterface $input, OutputInterface $output): int { |
|
| 85 | $circleId = $input->getArgument('circle_id'); |
|
| 86 | ||
| 87 | $circle = $this->circlesRequest->forceGetCircle($circleId); |
|
| 88 | ||
| 89 | echo json_encode($circle, JSON_PRETTY_PRINT) . "\n"; |
|
| 90 | ||
| 91 | return 0; |
|
| 92 | } |
|
| 93 | ||
| 94 | } |
|
| 95 | ||
| 96 | ||
| @@ 46-93 (lines=48) @@ | ||
| 43 | * |
|
| 44 | * @package OCA\Circles\Command |
|
| 45 | */ |
|
| 46 | class MembersDetails extends Base { |
|
| 47 | ||
| 48 | ||
| 49 | /** @var IL10N */ |
|
| 50 | private $l10n; |
|
| 51 | ||
| 52 | /** @var MembersRequest */ |
|
| 53 | private $membersRequest; |
|
| 54 | ||
| 55 | ||
| 56 | /** |
|
| 57 | * MembersDetails constructor. |
|
| 58 | * |
|
| 59 | * @param IL10N $l10n |
|
| 60 | * @param MembersRequest $membersRequest |
|
| 61 | */ |
|
| 62 | public function __construct(IL10N $l10n, MembersRequest $membersRequest) { |
|
| 63 | parent::__construct(); |
|
| 64 | $this->l10n = $l10n; |
|
| 65 | $this->membersRequest = $membersRequest; |
|
| 66 | } |
|
| 67 | ||
| 68 | ||
| 69 | protected function configure() { |
|
| 70 | parent::configure(); |
|
| 71 | $this->setName('circles:members:details') |
|
| 72 | ->setDescription('get details about a member by its ID') |
|
| 73 | ->addArgument('member_id', InputArgument::REQUIRED, 'ID of the member'); |
|
| 74 | } |
|
| 75 | ||
| 76 | ||
| 77 | /** |
|
| 78 | * @param InputInterface $input |
|
| 79 | * @param OutputInterface $output |
|
| 80 | * |
|
| 81 | * @return int |
|
| 82 | * @throws MemberDoesNotExistException |
|
| 83 | */ |
|
| 84 | protected function execute(InputInterface $input, OutputInterface $output): int { |
|
| 85 | $memberId = $input->getArgument('member_id'); |
|
| 86 | ||
| 87 | $member = $this->membersRequest->forceGetMemberById($memberId); |
|
| 88 | echo json_encode($member, JSON_PRETTY_PRINT) . "\n"; |
|
| 89 | ||
| 90 | return 0; |
|
| 91 | } |
|
| 92 | ||
| 93 | } |
|
| 94 | ||
| 95 | ||