|
|
|
@ -54,17 +54,21 @@ class YoutrackService implements YoutrackInterface
|
|
|
|
|
|
|
|
|
|
protected function requestYoutrackPath(string $path, array $query) {
|
|
|
|
|
$yt_url = $this->getYtUrl($path);
|
|
|
|
|
$yt_token = $this->getYtToken();
|
|
|
|
|
$headers = [
|
|
|
|
|
"Authorization" => "Bearer $yt_token",
|
|
|
|
|
'Cache-Control' => 'no-cache',
|
|
|
|
|
];
|
|
|
|
|
$headers = $this->getHeaders();
|
|
|
|
|
return $this->httpClient->request('GET', $yt_url, [
|
|
|
|
|
'query' => $query,
|
|
|
|
|
'headers' => $headers
|
|
|
|
|
]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected function getHeaders() {
|
|
|
|
|
$yt_token = $this->getYtToken();
|
|
|
|
|
return [
|
|
|
|
|
"Authorization" => "Bearer $yt_token",
|
|
|
|
|
'Cache-Control' => 'no-cache',
|
|
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function getReportId(): ?string
|
|
|
|
|
{
|
|
|
|
|
// --report option value should take precedence.
|
|
|
|
@ -157,4 +161,31 @@ class YoutrackService implements YoutrackInterface
|
|
|
|
|
);
|
|
|
|
|
return $reports;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function clearReportCache(string $report_id) :void {
|
|
|
|
|
$path = "/youtrack/api/reports/${report_id}/status";
|
|
|
|
|
$query = [
|
|
|
|
|
'$top' => -1,
|
|
|
|
|
'fields' => 'calculationInProgress,error(id),errorMessage,isOutdated,lastCalculated,progress,wikifiedErrorMessage'
|
|
|
|
|
];
|
|
|
|
|
$post = [
|
|
|
|
|
'lastCalculated' => floor(microtime(true) * 1000),
|
|
|
|
|
'calculationInProgress' => true,
|
|
|
|
|
'wikifiedErrorMessage' => '',
|
|
|
|
|
'isOutdated' => false,
|
|
|
|
|
'progress' => -1,
|
|
|
|
|
'error' => null,
|
|
|
|
|
'errorMessage' => null,
|
|
|
|
|
'$type' => 'ReportStatus'
|
|
|
|
|
];
|
|
|
|
|
$yt_url = $this->getYtUrl($path);
|
|
|
|
|
$response = $this->httpClient->request('POST', $yt_url, [
|
|
|
|
|
'query' => $query,
|
|
|
|
|
'headers' => $this->getHeaders(),
|
|
|
|
|
'json' => $post,
|
|
|
|
|
]);
|
|
|
|
|
$body = (string) $response->getBody()->getContents();
|
|
|
|
|
// var_dump($body);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|