Skip to content

Commit 238fcc3

Browse files
joshuachpJoshua Chapman
andauthored
[11.8] Add resource events API endpoints (#674)
* feat: add IssueLabelEvents api endpoing * feat: add all resource events api endpoints * fix: add missing define strict types * fix: remove leading slash in test paths * fix: remove leading slash in test paths * refactor: apply styleci patch * fix: typo and wrong test url * feat: add iteration and milestone APIs * refactor: apply style cli diff * fix: revert changes * fix: revert changes * fix: add missing copyright text Co-authored-by: Joshua Chapman <joshua.chapman@shellrent.com>
1 parent 8242c5f commit 238fcc3

11 files changed

+890
-0
lines changed
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
/*
6+
* This file is part of the Gitlab API library.
7+
*
8+
* (c) Matt Humphrey <matth@windsor-telecom.co.uk>
9+
* (c) Graham Campbell <hello@gjcampbell.co.uk>
10+
*
11+
* For the full copyright and license information, please view the LICENSE
12+
* file that was distributed with this source code.
13+
*/
14+
15+
namespace Gitlab\Api;
16+
17+
class ResourceIterationEvents extends AbstractApi
18+
{
19+
/**
20+
* @param int|string $project_id
21+
* @param int $issue_iid
22+
*
23+
* @return mixed
24+
*/
25+
public function all($project_id, int $issue_iid)
26+
{
27+
$path = 'issues/'.self::encodePath($issue_iid).'/resource_iteration_events';
28+
29+
return $this->get($this->getProjectPath($project_id, $path));
30+
}
31+
32+
/**
33+
* @param int|string $project_id
34+
* @param int $issue_iid
35+
* @param int $resource_iteration_event_id
36+
*
37+
* @return mixed
38+
*/
39+
public function show($project_id, int $issue_iid, int $resource_iteration_event_id)
40+
{
41+
$path = 'issues/'.self::encodePath($issue_iid).'/resource_iteration_events/';
42+
$path .= self::encodePath($resource_iteration_event_id);
43+
44+
return $this->get($this->getProjectPath($project_id, $path));
45+
}
46+
}

src/Api/ResourceLabelEvents.php

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
/*
6+
* This file is part of the Gitlab API library.
7+
*
8+
* (c) Matt Humphrey <matth@windsor-telecom.co.uk>
9+
* (c) Graham Campbell <hello@gjcampbell.co.uk>
10+
*
11+
* For the full copyright and license information, please view the LICENSE
12+
* file that was distributed with this source code.
13+
*/
14+
15+
namespace Gitlab\Api;
16+
17+
class ResourceLabelEvents extends AbstractApi
18+
{
19+
/**
20+
* @param int|string $project_id
21+
* @param int $issue_iid
22+
*
23+
* @return mixed
24+
*/
25+
public function all($project_id, int $issue_iid)
26+
{
27+
$path = 'issues/'.self::encodePath($issue_iid).'/resource_label_events';
28+
29+
return $this->get($this->getProjectPath($project_id, $path));
30+
}
31+
32+
/**
33+
* @param int|string $project_id
34+
* @param int $issue_iid
35+
* @param int $resource_label_event_id
36+
*
37+
* @return mixed
38+
*/
39+
public function show($project_id, int $issue_iid, int $resource_label_event_id)
40+
{
41+
$path = 'issues/'.self::encodePath($issue_iid).'/resource_label_events/';
42+
$path .= self::encodePath($resource_label_event_id);
43+
44+
return $this->get($this->getProjectPath($project_id, $path));
45+
}
46+
}
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
/*
6+
* This file is part of the Gitlab API library.
7+
*
8+
* (c) Matt Humphrey <matth@windsor-telecom.co.uk>
9+
* (c) Graham Campbell <hello@gjcampbell.co.uk>
10+
*
11+
* For the full copyright and license information, please view the LICENSE
12+
* file that was distributed with this source code.
13+
*/
14+
15+
namespace Gitlab\Api;
16+
17+
class ResourceMilestoneEvents extends AbstractApi
18+
{
19+
/**
20+
* @param int|string $project_id
21+
* @param int $issue_iid
22+
*
23+
* @return mixed
24+
*/
25+
public function all($project_id, int $issue_iid)
26+
{
27+
$path = 'issues/'.self::encodePath($issue_iid).'/resource_milestone_events';
28+
29+
return $this->get($this->getProjectPath($project_id, $path));
30+
}
31+
32+
/**
33+
* @param int|string $project_id
34+
* @param int $issue_iid
35+
* @param int $resource_milestone_event_id
36+
*
37+
* @return mixed
38+
*/
39+
public function show($project_id, int $issue_iid, int $resource_milestone_event_id)
40+
{
41+
$path = 'issues/'.self::encodePath($issue_iid).'/resource_milestone_events/';
42+
$path .= self::encodePath($resource_milestone_event_id);
43+
44+
return $this->get($this->getProjectPath($project_id, $path));
45+
}
46+
}

src/Api/ResourceStateEvents.php

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
/*
6+
* This file is part of the Gitlab API library.
7+
*
8+
* (c) Matt Humphrey <matth@windsor-telecom.co.uk>
9+
* (c) Graham Campbell <hello@gjcampbell.co.uk>
10+
*
11+
* For the full copyright and license information, please view the LICENSE
12+
* file that was distributed with this source code.
13+
*/
14+
15+
namespace Gitlab\Api;
16+
17+
class ResourceStateEvents extends AbstractApi
18+
{
19+
/**
20+
* @param int|string $project_id
21+
* @param int $issue_iid
22+
*
23+
* @return mixed
24+
*/
25+
public function all($project_id, int $issue_iid)
26+
{
27+
$path = 'issues/'.self::encodePath($issue_iid).'/resource_state_events';
28+
29+
return $this->get($this->getProjectPath($project_id, $path));
30+
}
31+
32+
/**
33+
* @param int|string $project_id
34+
* @param int $issue_iid
35+
* @param int $resource_label_event_id
36+
*
37+
* @return mixed
38+
*/
39+
public function show($project_id, int $issue_iid, int $resource_label_event_id)
40+
{
41+
$path = 'issues/'.self::encodePath($issue_iid).'/resource_state_events/';
42+
$path .= self::encodePath($resource_label_event_id);
43+
44+
return $this->get($this->getProjectPath($project_id, $path));
45+
}
46+
}

src/Api/ResourceWeightEvents.php

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
/*
6+
* This file is part of the Gitlab API library.
7+
*
8+
* (c) Matt Humphrey <matth@windsor-telecom.co.uk>
9+
* (c) Graham Campbell <hello@gjcampbell.co.uk>
10+
*
11+
* For the full copyright and license information, please view the LICENSE
12+
* file that was distributed with this source code.
13+
*/
14+
15+
namespace Gitlab\Api;
16+
17+
class ResourceWeightEvents extends AbstractApi
18+
{
19+
/**
20+
* @param int|string $project_id
21+
* @param int $issue_iid
22+
*
23+
* @return mixed
24+
*/
25+
public function all($project_id, int $issue_iid)
26+
{
27+
$path = 'issues/'.self::encodePath($issue_iid).'/resource_weight_events';
28+
29+
return $this->get($this->getProjectPath($project_id, $path));
30+
}
31+
32+
/**
33+
* @param int|string $project_id
34+
* @param int $issue_iid
35+
* @param int $resource_label_event_id
36+
*
37+
* @return mixed
38+
*/
39+
public function show($project_id, int $issue_iid, int $resource_label_event_id)
40+
{
41+
$path = 'issues/'.self::encodePath($issue_iid).'/resource_weight_events/';
42+
$path .= self::encodePath($resource_label_event_id);
43+
44+
return $this->get($this->getProjectPath($project_id, $path));
45+
}
46+
}

src/Client.php

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@
3333
use Gitlab\Api\Projects;
3434
use Gitlab\Api\Repositories;
3535
use Gitlab\Api\RepositoryFiles;
36+
use Gitlab\Api\ResourceIterationEvents;
37+
use Gitlab\Api\ResourceLabelEvents;
38+
use Gitlab\Api\ResourceMilestoneEvents;
39+
use Gitlab\Api\ResourceStateEvents;
40+
use Gitlab\Api\ResourceWeightEvents;
3641
use Gitlab\Api\Schedules;
3742
use Gitlab\Api\Snippets;
3843
use Gitlab\Api\SystemHooks;
@@ -218,6 +223,46 @@ public function issues(): Issues
218223
return new Issues($this);
219224
}
220225

226+
/**
227+
* @return ResourceIterationEvents
228+
*/
229+
public function resourceIterationEvents(): ResourceIterationEvents
230+
{
231+
return new ResourceIterationEvents($this);
232+
}
233+
234+
/**
235+
* @return ResourceLabelEvents
236+
*/
237+
public function resourceLabelEvents(): ResourceLabelEvents
238+
{
239+
return new ResourceLabelEvents($this);
240+
}
241+
242+
/**
243+
* @return ResourceMilestoneEvents
244+
*/
245+
public function resourceMilestoneEvents(): ResourceMilestoneEvents
246+
{
247+
return new ResourceMilestoneEvents($this);
248+
}
249+
250+
/**
251+
* @return ResourceStateEvents
252+
*/
253+
public function resourceStateEvents(): ResourceStateEvents
254+
{
255+
return new ResourceStateEvents($this);
256+
}
257+
258+
/**
259+
* @return ResourceWeightEvents
260+
*/
261+
public function resourceWeightEvents(): ResourceWeightEvents
262+
{
263+
return new ResourceWeightEvents($this);
264+
}
265+
221266
/**
222267
* @return IssuesStatistics
223268
*/

0 commit comments

Comments
 (0)