Skip to content
This repository was archived by the owner on Jan 14, 2025. It is now read-only.

Sync complex package with main repository changes #3

Open
wants to merge 22 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
4b8f486
add fix for nullable parent prop in IssueField (#516)
bTokman Sep 4, 2023
0601219
Apply fixes from StyleCI (#517)
lesstif Sep 4, 2023
6d186c0
Add cURL proxy type configuration (#519)
rleroi Sep 6, 2023
35be23f
Set types correctly for Version class (#518)
reinfi Sep 6, 2023
25f83be
fixed #522 avoiding $emailAddress property accessed before initializ…
lesstif Sep 26, 2023
1306db5
Fix constructor for Version class (#521)
reinfi Sep 26, 2023
8ce2cfe
- implemented Move issues to Sprint
lesstif Oct 1, 2023
69dfc13
Apply fixes from StyleCI (#524)
lesstif Oct 1, 2023
d375c35
fixed #526 I've implemented getting customField action.
lesstif Mar 24, 2024
db8b8d0
Allow null values (#527)
flack Mar 24, 2024
387c4ab
Apply fixes from StyleCI (#529)
lesstif Mar 24, 2024
83d4f8d
Ensure property exist before assignation (#531)
jeremy379 Apr 22, 2024
fb62c0e
Introduce timeout to cURL exec from .env file (#533)
jepster Apr 22, 2024
e01f543
feat: added endpoint to find workload by ID (#537)
ppacz Sep 16, 2024
087718a
Add New Method for Returning Board List With Offset/Paginated Results…
nickpoulos Sep 16, 2024
06c20a4
fixed #536, #534
lesstif Sep 16, 2024
2d5e7c5
Set default to null for all nullable properties (#545)
victorlap Apr 5, 2025
7dc9fe2
feat: endpoint to find workloads by IDs (#538)
ppacz Apr 5, 2025
d203e9c
Update Comment.php (#539)
armino-dev Apr 5, 2025
21331c4
disable strict object type check in JsonMapper (#541)
otzy Apr 5, 2025
46b2040
Set default values for changelog + fixVersions (#543)
hgriga Apr 5, 2025
a6a96c0
Apply fixes from StyleCI (#546)
lesstif Apr 5, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2470,6 +2470,43 @@ try {
}

```

#### Get boards
[See Jira API reference](https://developer.atlassian.com/cloud/jira/software/rest/#api-rest-agile-1-0-board-get)

```php
<?php
require 'vendor/autoload.php';

use JiraRestApi\Board\BoardService;

try {
$results = [];
$startAt = 0;
$maxResults = 50; // maximum allowed for board queries

do {
$response = $this->boardService->getBoards([
'startAt' => $startAt,
'maxResults' => $maxResults
]);

$results = [...$results, ...$response->getBoards()];

$startAt += $maxResults;

} while($startAt < $response->total);

var_dump($results);

} catch (JiraRestApi\JiraException $e) {
print('Error Occured! ' . $e->getMessage());
}

```



#### Get board info
[See Jira API reference](https://developer.atlassian.com/cloud/jira/software/rest/#api-rest-agile-1-0-board-boardId-get)

Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"php": "^8.0",
"ext-curl": "*",
"ext-json": "*",
"netresearch/jsonmapper": "^3.0|^4.0|^5.0",
"netresearch/jsonmapper": "^4.2",
"monolog/monolog": "^2.0|^3.0"
},
"suggest": {
Expand Down
2 changes: 1 addition & 1 deletion src/Auth/AuthService.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public function getSessionCookieValue()
* @throws \Exception
* @throws \JiraRestApi\JiraException
*/
public function __construct(ConfigurationInterface $configuration = null, LoggerInterface $logger = null, $path = './')
public function __construct(?ConfigurationInterface $configuration = null, ?LoggerInterface $logger = null, $path = './')
{
parent::__construct($configuration, $logger, $path);
$this->setAPIUri($this->auth_api_uri);
Expand Down
52 changes: 51 additions & 1 deletion src/Board/BoardService.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class BoardService extends \JiraRestApi\JiraClient

private $agileVersion = '1.0';

public function __construct(ConfigurationInterface $configuration = null, LoggerInterface $logger = null, $path = './')
public function __construct(?ConfigurationInterface $configuration = null, ?LoggerInterface $logger = null, $path = './')
{
parent::__construct($configuration, $logger, $path);
$this->setAPIUri('/rest/agile/'.$this->agileVersion);
Expand Down Expand Up @@ -46,6 +46,31 @@ public function getBoardList($paramArray = []): ?\ArrayObject
}
}

/**
* Get list of boards with paginated results.
*
* @param array $paramArray
*
* @throws \JiraRestApi\JiraException
*
* @return PaginatedResult|null array of Board class
*/
public function getBoards($paramArray = []): ?PaginatedResult
{
$json = $this->exec($this->uri.$this->toHttpQueryParameter($paramArray), null);

try {
return $this->json_mapper->map(
json_decode($json, false, 512, $this->getJsonOptions()),
new PaginatedResult()
);
} catch (\JsonException $exception) {
$this->log->error("Response cannot be decoded from json\nException: {$exception->getMessage()}");

return null;
}
}

public function getBoard($id, $paramArray = []): ?Board
{
$json = $this->exec($this->uri.'/'.$id.$this->toHttpQueryParameter($paramArray), null);
Expand Down Expand Up @@ -122,6 +147,31 @@ public function getBoardSprints($boardId, $paramArray = []): ?\ArrayObject
}
}

/**
* Get list of boards with paginated results.
*
* @param array $paramArray
*
* @throws \JiraRestApi\JiraException
*
* @return PaginatedResult|null array of Board class
*/
public function getSprintsForBoard($boardId, $paramArray = []): ?PaginatedResult
{
$json = $this->exec($this->uri.'/'.$boardId.'/sprint'.$this->toHttpQueryParameter($paramArray), null);

try {
return $this->json_mapper->map(
json_decode($json, false, 512, $this->getJsonOptions()),
new PaginatedResult()
);
} catch (\JsonException $exception) {
$this->log->error("Response cannot be decoded from json\nException: {$exception->getMessage()}");

return null;
}
}

/**
* @return \ArrayObject|Epic[]|null
*/
Expand Down
129 changes: 129 additions & 0 deletions src/Board/PaginatedResult.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
<?php

namespace JiraRestApi\Board;

/**
* Paginated Result object for BoardService.
*/
class PaginatedResult
{
/**
* @var string
*/
public $expand;

/**
* @var int
*/
public $startAt;

/**
* @var int
*/
public $maxResults;

/**
* @var int
*/
public $total;

/**
* @var array
*/
public $values;

/**
* @var bool
*/
public $isLast;

/**
* @return int
*/
public function getStartAt()
{
return $this->startAt;
}

/**
* @param int $startAt
*/
public function setStartAt($startAt)
{
$this->startAt = $startAt;
}

/**
* @return int
*/
public function getMaxResults()
{
return $this->maxResults;
}

/**
* @param int $maxResults
*/
public function setMaxResults($maxResults)
{
$this->maxResults = $maxResults;
}

/**
* @return int
*/
public function getTotal()
{
return $this->total;
}

/**
* @param int $total
*/
public function setTotal($total)
{
$this->total = $total;
}

/**
* @return array
*/
public function getValues()
{
return $this->values;
}

/**
* @param array $values
*/
public function setValues($values)
{
$this->values = $values;
}

/**
* @param int $index
*
* @return mixed
*/
public function getValue($index)
{
return $this->values[$index];
}

/**
* @return string
*/
public function getExpand()
{
return $this->expand;
}

/**
* @param string $expand
*/
public function setExpand($expand)
{
$this->expand = $expand;
}
}
2 changes: 1 addition & 1 deletion src/Component/Component.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class Component implements \JsonSerializable

public string $description;

public ?User $lead;
public ?User $lead = null;

public string $leadUserName;

Expand Down
10 changes: 10 additions & 0 deletions src/Configuration/AbstractConfiguration.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,11 @@ abstract class AbstractConfiguration implements ConfigurationInterface
*/
protected ?string $proxyPort = null;

/**
* Proxy type.
*/
protected ?int $proxyType = null;

/**
* Proxy user.
*/
Expand Down Expand Up @@ -198,6 +203,11 @@ public function getProxyPort(): ?string
return $this->proxyPort;
}

public function getProxyType(): ?int
{
return $this->proxyType;
}

public function getProxyUser(): ?string
{
return $this->proxyUser;
Expand Down
1 change: 1 addition & 0 deletions src/Configuration/ArrayConfiguration.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* Created by PhpStorm.
* User: keanor
Expand Down
6 changes: 6 additions & 0 deletions src/Configuration/ConfigurationInterface.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* Created by PhpStorm.
* User: keanor
Expand Down Expand Up @@ -96,6 +97,11 @@ public function getProxyServer(): ?string;
*/
public function getProxyPort(): ?string;

/**
* Proxy type.
*/
public function getProxyType(): ?int;

/**
* Proxy user.
*/
Expand Down
1 change: 1 addition & 0 deletions src/Configuration/DotEnvConfiguration.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public function __construct(string $path = '.')
$this->curlOptVerbose = $this->env('CURLOPT_VERBOSE', false);
$this->proxyServer = $this->env('PROXY_SERVER');
$this->proxyPort = $this->env('PROXY_PORT');
$this->proxyType = $this->env('PROXY_TYPE');
$this->proxyUser = $this->env('PROXY_USER');
$this->proxyPassword = $this->env('PROXY_PASSWORD');

Expand Down
2 changes: 1 addition & 1 deletion src/Epic/EpicService.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class EpicService extends \JiraRestApi\JiraClient
private $uri = '/epic';
private $version = '1.0';

public function __construct(ConfigurationInterface $configuration = null, LoggerInterface $logger = null, $path = './')
public function __construct(?ConfigurationInterface $configuration = null, ?LoggerInterface $logger = null, $path = './')
{
parent::__construct($configuration, $logger, $path);
$this->setAPIUri('/rest/agile/'.$this->version);
Expand Down
2 changes: 1 addition & 1 deletion src/Issue/AgileIssueService.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class AgileIssueService extends \JiraRestApi\JiraClient

private $agileVersion = '1.0';

public function __construct(ConfigurationInterface $configuration = null, LoggerInterface $logger = null, $path = './')
public function __construct(?ConfigurationInterface $configuration = null, ?LoggerInterface $logger = null, $path = './')
{
parent::__construct($configuration, $logger, $path);
$this->setAPIUri('/rest/agile/'.$this->agileVersion);
Expand Down
3 changes: 3 additions & 0 deletions src/Issue/Comment.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ class Comment implements \JsonSerializable
/** @var string */
public $body;

/** @var string */
public $renderedBody;

/** @var \JiraRestApi\Issue\Reporter */
public $updateAuthor;

Expand Down
41 changes: 41 additions & 0 deletions src/Issue/CustomField.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?php

namespace JiraRestApi\Issue;

class CustomField implements \JsonSerializable
{
public int $id;

public string $name;

public string $description;

public array $type;

public string $searcherKey;

public array $projectIds;

public array $issueTypeIds;

public string $self;

public int $numericId;

public bool $isLocked;

public bool $isManaged;

public bool $isAllProjects;

public bool $isTrusted;

public int $projectsCount;

public int $screensCount;

public function jsonSerialize(): mixed
{
return array_filter(get_object_vars($this));
}
}
Loading