Skip to content

Commit

Permalink
Merge pull request #4 from bassurman/main
Browse files Browse the repository at this point in the history
[SW] - added functionality to handle API requests with commands
  • Loading branch information
doishub authored Jun 24, 2024
2 parents 49f0f28 + 0716110 commit b1b622e
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 1 deletion.
22 changes: 22 additions & 0 deletions src/Api/Commands.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

namespace Oveleon\YouTrack\Api;

class Commands extends AbstractApi
{
protected function defaultFields(): self
{
$this->addFields([
'id',
'idReadable',
'summary'
]);

return $this;
}

public function command($parameters): array
{
return $this->post("commands", $parameters);
}
}
6 changes: 6 additions & 0 deletions src/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use Oveleon\YouTrack\Api\Issue;
use Oveleon\YouTrack\Api\Project;
use Oveleon\YouTrack\Api\Commands;
use Oveleon\YouTrack\Api\User;
use Oveleon\YouTrack\Api\WorkItem;
use Oveleon\YouTrack\HttpClient\HttpClientInterface;
Expand All @@ -30,6 +31,11 @@ public function issues(): Issue
return new Issue($this);
}

public function commands(): Commands
{
return new Commands($this);
}

public function projects(): Project
{
return new Project($this);
Expand Down
2 changes: 1 addition & 1 deletion src/HttpClient/HttpClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
use Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface;
use Symfony\Contracts\HttpClient\HttpClientInterface as SymfonyHttpClientInterface;

class HttpClient implements HttpClientInterface
final class HttpClient implements HttpClientInterface
{
private SymfonyHttpClientInterface $client;
private string $endpoint;
Expand Down

0 comments on commit b1b622e

Please sign in to comment.