Skip to content

Commit

Permalink
#181: Continued cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
tuj committed Jan 4, 2024
1 parent 9efe11e commit ef7c95b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 46 deletions.
9 changes: 9 additions & 0 deletions src/Interface/DataProviderServiceInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand All @@ -32,4 +35,10 @@ public function getIssuesDataForProjectPaged(string $projectId, int $startAt = 0

/** @return array<WorklogData> */
public function getWorklogDataForProject(string $projectId): array;

public function getSprintReportData(string $projectId, string $versionId): SprintReportData;

public function getSprintReportProjects(): SprintReportProjects;

public function getSprintReportProjectVersions(string $projectId): SprintReportVersions;
}
55 changes: 9 additions & 46 deletions src/Service/LeantimeApiService.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand All @@ -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.
*
Expand All @@ -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]);
}
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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.
*
Expand Down

0 comments on commit ef7c95b

Please sign in to comment.