From ef7c95bf5a2216abbb6f70aec6f1dee8e6bf7e6d Mon Sep 17 00:00:00 2001 From: Troels Ugilt Jensen <6103205+tuj@users.noreply.github.com> Date: Thu, 4 Jan 2024 19:14:31 +0100 Subject: [PATCH] #181: Continued cleanup --- .../DataProviderServiceInterface.php | 9 +++ src/Service/LeantimeApiService.php | 55 +++---------------- 2 files changed, 18 insertions(+), 46 deletions(-) diff --git a/src/Interface/DataProviderServiceInterface.php b/src/Interface/DataProviderServiceInterface.php index fde7e9f8..d82da75d 100644 --- a/src/Interface/DataProviderServiceInterface.php +++ b/src/Interface/DataProviderServiceInterface.php @@ -8,6 +8,9 @@ use App\Model\Invoices\ProjectData; use App\Model\Invoices\WorklogData; use App\Model\Planning\PlanningData; +use App\Model\SprintReport\SprintReportData; +use App\Model\SprintReport\SprintReportProjects; +use App\Model\SprintReport\SprintReportVersions; interface DataProviderServiceInterface { @@ -32,4 +35,10 @@ public function getIssuesDataForProjectPaged(string $projectId, int $startAt = 0 /** @return array */ public function getWorklogDataForProject(string $projectId): array; + + public function getSprintReportData(string $projectId, string $versionId): SprintReportData; + + public function getSprintReportProjects(): SprintReportProjects; + + public function getSprintReportProjectVersions(string $projectId): SprintReportVersions; } diff --git a/src/Service/LeantimeApiService.php b/src/Service/LeantimeApiService.php index 6b68a956..17b165db 100644 --- a/src/Service/LeantimeApiService.php +++ b/src/Service/LeantimeApiService.php @@ -67,23 +67,6 @@ public function getWorklogDataForProject(string $projectId): array throw new \Exception("Not implemented"); } - public function getEndpoints(): array - { - return [ - 'base' => $this->leantimeUrl, - ]; - } - - /** - * Get all projects, including archived. - * - * @throws ApiServiceException - */ - public function getAllProjects(): mixed - { - return $this->request(self::API_PATH_JSONRPC, 'POST', 'leantime.rpc.projects.getAll', []); - } - /** * Get all projects, including archived. * @@ -108,26 +91,6 @@ public function getSprintReportProjects(): SprintReportProjects return $sprintReportProjects; } - /** - * getSprintReportProject. - * - * @param $key - * A project key or id - * - * @return SprintReportProject SprintReportProject - * - * @throws ApiServiceException - */ - public function getSprintReportProject(string $projectId): SprintReportProject - { - $project = $this->request(self::API_PATH_JSONRPC, 'POST', 'leantime.rpc.projects.getProject', ['id' => $projectId]); - - return new SprintReportProject( - $project->id, - $project->name - ); - } - /** * Get project. * @@ -149,7 +112,7 @@ public function getProject($key): mixed * * @throws ApiServiceException */ - public function getMilestone($key): mixed + private function getMilestone($key): mixed { return $this->request(self::API_PATH_JSONRPC, 'POST', 'leantime.rpc.tickets.getTicket', ['id' => $key]); } @@ -421,14 +384,6 @@ public function getTimesheetsForTicket($ticketId): mixed return $this->request(self::API_PATH_JSONRPC, 'POST', 'leantime.rpc.timesheets.getAll', ['invEmpl' => '-1', 'invComp' => '-1', 'paid' => '-1', 'ticketFilter' => $ticketId]); } - /** - * @throws ApiServiceException - */ - private function getIssuesForProjectMilestone($projectId, $milestoneId): array - { - return $this->request(self::API_PATH_JSONRPC, 'POST', 'leantime.rpc.tickets.getAll', ['searchCriteria' => ['currentProject' => $projectId, 'milestone' => $milestoneId]]); - } - /** * @throws ApiServiceException * @throws \Exception @@ -566,6 +521,14 @@ public function getSprintReportData(string $projectId, string $versionId): Sprin return $sprintReportData; } + /** + * @throws ApiServiceException + */ + private function getIssuesForProjectMilestone($projectId, $milestoneId): array + { + return $this->request(self::API_PATH_JSONRPC, 'POST', 'leantime.rpc.tickets.getAll', ['searchCriteria' => ['currentProject' => $projectId, 'milestone' => $milestoneId]]); + } + /** * Get from Leantime. *