getTeams(), JSON_UNESCAPED_UNICODE); exit; } if ($method === 'GET' && $path === '/api/config') { echo json_encode($api->getPublicConfig(), JSON_UNESCAPED_UNICODE); exit; } if ($method === 'GET' && preg_match('#^/api/teams/(\d+)/sprints$#', $path, $matches)) { echo json_encode($api->getSprintsByTeamId((int) $matches[1]), JSON_UNESCAPED_UNICODE); exit; } if ($method === 'GET' && preg_match('#^/api/teams/(\d+)/tasks$#', $path, $matches)) { $page = max(1, (int) ($_GET['page'] ?? 1)); $perPage = max(1, min(100, (int) ($_GET['per_page'] ?? 50))); $result = $api->getTasksByTeamId((int) $matches[1], $page, $perPage); if ($result === null) { http_response_code(404); echo json_encode(['error' => 'Team not found'], JSON_UNESCAPED_UNICODE); exit; } echo json_encode($result, JSON_UNESCAPED_UNICODE); exit; } if ($method === 'GET' && preg_match('#^/api/sprints/(\d+)/tasks$#', $path, $matches)) { echo json_encode($api->getTasksBySprintId((int) $matches[1]), JSON_UNESCAPED_UNICODE); exit; } if ($method === 'GET' && preg_match('#^/api/sprints/(\d+)$#', $path, $matches)) { $sprint = $api->getSprintById((int) $matches[1]); if ($sprint === null) { http_response_code(404); echo json_encode(['error' => 'Sprint not found'], JSON_UNESCAPED_UNICODE); exit; } echo json_encode($sprint, JSON_UNESCAPED_UNICODE); exit; } http_response_code(404); echo json_encode(['error' => 'Not found'], JSON_UNESCAPED_UNICODE); } catch (Throwable $e) { http_response_code(500); echo json_encode(['error' => $e->getMessage()], JSON_UNESCAPED_UNICODE); }