Skip to content

Commit 80b6607

Browse files
committed
Worklog additions, minor updates.
1 parent 1cbe6b6 commit 80b6607

File tree

7 files changed

+130
-74
lines changed

7 files changed

+130
-74
lines changed

README.md

Lines changed: 2 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# Jira API client for Laravel 5.4+
1+
# Jira API client for Laravel 9+
22

3-
Perform various operations of [Jira APIs](https://developer.atlassian.com/cloud/jira/platform/rest/) with Laravel 5.4+
3+
Perform various operations of [Jira APIs](https://developer.atlassian.com/cloud/jira/platform/rest/) with Laravel 9+
44

55
The aim of the package is to make it easier to communicate with the API. By default the response from the request is not altered in any way.
66
By creating your own implementation or by using the simple helpers provided with the package you are able to integrate Jira the way you like.
@@ -13,32 +13,6 @@ composer require rjvandoesburg/laravel-jira-rest-client
1313
```
1414
Do note that not all methods have been implemented yet.
1515

16-
Laravel 5.5 uses Package Auto-Discovery, so doesn't require you to manually add the ServiceProvider.
17-
18-
## Laravel 5.4:
19-
20-
If you don't use auto-discovery, add the ServiceProvider to the providers array in `config/app.php`
21-
```php
22-
<?php
23-
24-
'providers' => [
25-
// ...
26-
27-
Atlassian\JiraRest\JiraRestServiceProvider::class,
28-
],
29-
```
30-
31-
Also locate the `Aliases` key in your `config/app.php` file and register the Facade:
32-
33-
```php
34-
<?php
35-
36-
'aliases' => [
37-
// ...
38-
39-
'Jira' => Atlassian\JiraRest\Facades\Jira::class,
40-
],
41-
```
4216
Copy the package config to your local config with the publish command:
4317
```shell
4418
php artisan vendor:publish --provider="Atlassian\JiraRest\JiraRestServiceProvider"

composer.json

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,39 @@
11
{
2-
"name": "rjvandoesburg/laravel-jira-rest-client",
3-
"license": "MIT",
4-
"authors": [
5-
{
6-
"name": "Robert-John van Doesburg",
7-
"email": "rjvandoesburg@gmail.com"
8-
}
9-
],
10-
"minimum-stability": "stable",
11-
"require": {
12-
"php": ">=5.6.4",
13-
"laravel/framework": "*",
14-
"guzzlehttp/guzzle": "^6.0|^7.0",
15-
"ext-json": "*"
16-
},
17-
"autoload": {
18-
"psr-4": {
19-
"Atlassian\\JiraRest\\": "src/"
20-
},
21-
"files": [
22-
"src/helpers.php"
23-
]
24-
},
25-
"extra": {
26-
"laravel": {
27-
"providers": [
28-
"Atlassian\\JiraRest\\JiraRestServiceProvider"
29-
],
30-
"aliases": {
31-
"Jira": "Atlassian\\JiraRest\\Facades\\Jira"
32-
}
33-
}
2+
"name": "rjvandoesburg/laravel-jira-rest-client",
3+
"license": "MIT",
4+
"authors": [
5+
{
6+
"name": "Robert-John van Doesburg",
7+
"email": "rjvandoesburg@gmail.com"
8+
}
9+
],
10+
"minimum-stability": "stable",
11+
"require": {
12+
"php": ">=8.0",
13+
"laravel/framework": "*",
14+
"guzzlehttp/guzzle": "^6.0|^7.0",
15+
"ext-json": "*"
16+
},
17+
"autoload": {
18+
"psr-4": {
19+
"Atlassian\\JiraRest\\": "src/"
3420
},
35-
"suggest": {
36-
"salsify/json-streaming-parser": "Require this when you want to parse the response in blocks",
37-
"guzzlehttp/oauth-subscriber": "Required when using OAuth authentication"
21+
"files": [
22+
"src/helpers.php"
23+
]
24+
},
25+
"extra": {
26+
"laravel": {
27+
"providers": [
28+
"Atlassian\\JiraRest\\JiraRestServiceProvider"
29+
],
30+
"aliases": {
31+
"Jira": "Atlassian\\JiraRest\\Facades\\Jira"
32+
}
3833
}
34+
},
35+
"suggest": {
36+
"salsify/json-streaming-parser": "Require this when you want to parse the response in blocks",
37+
"guzzlehttp/oauth-subscriber": "Required when using OAuth authentication"
38+
}
3939
}

src/Helpers/Response/Listener.php

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -234,12 +234,16 @@ public function key($key)
234234
public function value($value)
235235
{
236236
// Replace a string with the php value
237-
if ($value === 'true') {
238-
$value = true;
239-
} elseif($value === 'false') {
240-
$value = false;
241-
} elseif ($value === 'null') {
242-
$value = null;
237+
switch ($value) {
238+
case 'true':
239+
$value = true;
240+
break;
241+
case 'false':
242+
$value = false;
243+
break;
244+
case 'null':
245+
$value = null;
246+
break;
243247
}
244248

245249
// If the top level is an object, return the key values
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?php
2+
3+
namespace Atlassian\JiraRest\Requests;
4+
5+
class FailedWebhookRequest extends AbstractRequest
6+
{
7+
/**
8+
* Get failed webhooks.
9+
*
10+
* @see https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-webhooks/#api-rest-api-3-webhook-failed-get
11+
*
12+
* @param \Atlassian\JiraRest\Requests\Issue\Parameters\Transitions\DoTransitionsParameters|array
13+
*
14+
* @return \GuzzleHttp\Psr7\Response
15+
* @throws \Atlassian\JiraRest\Exceptions\JiraClientException
16+
* @throws \Atlassian\JiraRest\Exceptions\JiraNotFoundException
17+
* @throws \Atlassian\JiraRest\Exceptions\JiraUnauthorizedException
18+
* @throws \GuzzleHttp\Exception\GuzzleException
19+
*/
20+
public function get($parameters = [])
21+
{
22+
return $this->execute('get', 'webhook/failed', $parameters);
23+
}
24+
}

src/Requests/Issue/IssueRequest.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,9 @@ public function bulkCreate()
4848
* @see https://developer.atlassian.com/cloud/jira/platform/rest/v3/#api-rest-api-3-issue-createmeta-get
4949
* @throws \Exception
5050
*/
51-
public function getCreateMetadata()
51+
public function getCreateMetadata(array $parameters = [])
5252
{
53-
// TODO: implement
54-
throw new \Exception('Not yet implemented');
53+
return $this->execute('get', "issue/createmeta", $parameters);
5554
}
5655

5756
/**

src/Requests/Issue/Traits/WorklogsRequests.php

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,4 +130,59 @@ public function deleteWorklog($issueIdOrKey, $workdlogId, $parameters = [])
130130
return $this->execute('delete', "issue/{$issueIdOrKey}/worklog/{$workdlogId}", $parameters);
131131
}
132132

133+
134+
/**
135+
* Returns a list of IDs and update timestamps for worklogs updated after a date and time.
136+
*
137+
* @see https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-worklogs/#api-rest-api-3-worklog-updated-get
138+
*
139+
* @param array|\Illuminate\Contracts\Support\Arrayable $parameters
140+
*
141+
* @return \GuzzleHttp\Psr7\Response
142+
* @throws \Atlassian\JiraRest\Exceptions\JiraClientException
143+
* @throws \Atlassian\JiraRest\Exceptions\JiraUnauthorizedException
144+
* @throws \GuzzleHttp\Exception\GuzzleException
145+
* @throws \TypeError
146+
*/
147+
public function getUpdatedWorklogs($parameters = [])
148+
{
149+
return $this->execute('get', "worklog/updated", $parameters);
150+
}
151+
152+
153+
/**
154+
* Returns the worklogs with all the information
155+
*
156+
* @see https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-worklogs/#api-rest-api-3-worklog-updated-get
157+
*
158+
* @param array|\Illuminate\Contracts\Support\Arrayable $parameters
159+
*
160+
* @return \GuzzleHttp\Psr7\Response
161+
* @throws \Atlassian\JiraRest\Exceptions\JiraClientException
162+
* @throws \Atlassian\JiraRest\Exceptions\JiraUnauthorizedException
163+
* @throws \GuzzleHttp\Exception\GuzzleException
164+
* @throws \TypeError
165+
*/
166+
public function getRealWorklogs($parameters = [])
167+
{
168+
return $this->execute('post', "worklog/list", $parameters);
169+
}
170+
171+
/**
172+
* Returns the ids of all deleted worklogs
173+
*
174+
* @see https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-worklogs/#api-rest-api-3-worklog-updated-get
175+
*
176+
* @param array|\Illuminate\Contracts\Support\Arrayable $parameters
177+
*
178+
* @return \GuzzleHttp\Psr7\Response
179+
* @throws \Atlassian\JiraRest\Exceptions\JiraClientException
180+
* @throws \Atlassian\JiraRest\Exceptions\JiraUnauthorizedException
181+
* @throws \GuzzleHttp\Exception\GuzzleException
182+
* @throws \TypeError
183+
*/
184+
public function getDeletedWorklogs($parameters = [])
185+
{
186+
return $this->execute('get', "worklog/deleted", $parameters);
187+
}
133188
}

src/Requests/Workflow/WorkflowRequest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace Atlassian\JiraRest\Requests\Workflow;
3+
namespace Atlassian\JiraRest\Requests\User;
44

55
use Atlassian\JiraRest\Requests\AbstractRequest;
66

@@ -31,4 +31,4 @@ public function getApi()
3131
{
3232
return 'rest/api/3';
3333
}
34-
}
34+
}

0 commit comments

Comments
 (0)