Skip to content

Commit fde105b

Browse files
authored
Merge branch 'KnpLabs:master' into master
2 parents a7ae16f + 055cf51 commit fde105b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+832
-129
lines changed

.github/workflows/ci.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
strategy:
1212
fail-fast: false
1313
matrix:
14-
php-versions: ['7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3']
14+
php-versions: ['7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4']
1515

1616
steps:
1717
- uses: actions/checkout@v4
@@ -23,10 +23,12 @@ jobs:
2323
coverage: none
2424

2525
- name: Install Composer Dependencies
26-
uses: ramsey/composer-install@v2
26+
uses: ramsey/composer-install@v3
2727

2828
- name: Run phpunit
2929
run: vendor/bin/phpunit --verbose
30+
env:
31+
SYMFONY_DEPRECATIONS_HELPER: 'max[self]=0'
3032

3133
phpstan:
3234
name: PHPStan
@@ -41,7 +43,7 @@ jobs:
4143
coverage: none
4244

4345
- name: Install Composer Dependencies
44-
uses: ramsey/composer-install@v2
46+
uses: ramsey/composer-install@v3
4547

4648
- name: Run phpstan
4749
run: vendor/bin/phpstan analyse --no-progress

CHANGELOG-3.X.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,23 @@
11
# Changelog
22

3+
## 3.15.0
4+
5+
### Added
6+
- Fix implicit nullable types to avoid PHP 8.4 warnings ([eiriksm](https://github.com/eiriksm), [acrobat](https://github.com/acrobat)) [#1144](https://github.com/KnpLabs/php-github-api/issues/1144)
7+
- Add API endpoints to interact with organization roles ([glaubinix](https://github.com/glaubinix)) [#1143](https://github.com/KnpLabs/php-github-api/issues/1143)
8+
- Copilot Usage Endpoints ([anthony-webart](https://github.com/anthony-webart)) [#1142](https://github.com/KnpLabs/php-github-api/issues/1142)
9+
- Fix type error in ResultPager::fetch ([nunoplopes](https://github.com/nunoplopes)) [#1132](https://github.com/KnpLabs/php-github-api/issues/1132)
10+
11+
## 3.14.1
12+
13+
### Fixed
14+
- Handle case of GitHub returning 204 No Content in some scenarios ([tomcorbett](https://github.com/tomcorbett)) [#1135](https://github.com/KnpLabs/php-github-api/issues/1135)
15+
16+
## 3.14.0
17+
18+
### Added
19+
- Allow php-http/cache-plugin v2 ([GrahamCampbell](https://github.com/GrahamCampbell)) [#1134](https://github.com/KnpLabs/php-github-api/issues/1134)
20+
321
## 3.13.0
422

523
### Added

composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"require": {
2020
"php": "^7.2.5 || ^8.0",
2121
"ext-json": "*",
22-
"php-http/cache-plugin": "^1.7.1",
22+
"php-http/cache-plugin": "^1.7.1|^2.0",
2323
"php-http/client-common": "^2.3",
2424
"php-http/discovery": "^1.12",
2525
"php-http/httplug": "^2.2",
@@ -33,7 +33,7 @@
3333
},
3434
"require-dev": {
3535
"symfony/cache": "^5.1.8",
36-
"guzzlehttp/psr7": "^1.7",
36+
"guzzlehttp/psr7": "^2.7",
3737
"http-interop/http-factory-guzzle": "^1.0",
3838
"guzzlehttp/guzzle": "^7.2",
3939
"php-http/mock-client": "^1.4.1",
@@ -52,7 +52,7 @@
5252
"extra": {
5353
"branch-alias": {
5454
"dev-2.x": "2.20.x-dev",
55-
"dev-master": "3.13-dev"
55+
"dev-master": "3.15-dev"
5656
}
5757
},
5858
"config": {

doc/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ v3 APIs:
4444
* [Secrets](organization/actions/secrets.md)
4545
* [Variables](organization/actions/variables.md)
4646
* [Secret Scanning Alert](organization/secret-scanning.md)
47+
* [Organization Roles](organization/organization-roles.md)
4748
* [Projects](project/projects.md)
4849
* [Columns](project/columns.md)
4950
* [Cards](project/cards.md)

doc/copilot/usage.md

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
# Copilot Usage API Documentation
2+
[Back to the navigation](../README.md)
3+
4+
## Overview
5+
6+
The Copilot Usage API provides endpoints to retrieve usage summaries for organizations and enterprises.
7+
8+
**Note**: This endpoint is in beta and is subject to change.
9+
10+
## Endpoints
11+
12+
### Organization Usage Summary
13+
14+
Retrieve the usage summary for a specific organization.
15+
16+
**Method:** `GET`
17+
18+
**Endpoint:** `/orgs/{organization}/copilot/usage`
19+
20+
**Parameters:**
21+
- `organization` (string): The name of the organization.
22+
- `params` (array, optional): Additional query parameters.
23+
24+
**Example:**
25+
```php
26+
$usage = $client->api('copilotUsage')->orgUsageSummary('KnpLabs');
27+
```
28+
29+
### Organization Team Usage Summary
30+
31+
Retrieve the usage summary for a specific team within an organization.
32+
33+
**Method:** `GET`
34+
35+
**Endpoint:** `/orgs/{organization}/team/{team}/copilot/usage`
36+
37+
**Parameters:**
38+
- `organization` (string): The name of the organization.
39+
- `team` (string): The name of the team.
40+
- `params` (array, optional): Additional query parameters.
41+
42+
**Example:**
43+
```php
44+
$usage = $client->api('copilotUsage')->orgTeamUsageSummary('KnpLabs', 'developers');
45+
```
46+
47+
### Enterprise Usage Summary
48+
49+
Retrieve the usage summary for a specific enterprise.
50+
51+
**Method:** `GET`
52+
53+
**Endpoint:** `/enterprises/{enterprise}/copilot/usage`
54+
55+
**Parameters:**
56+
- `enterprise` (string): The name of the enterprise.
57+
- `params` (array, optional): Additional query parameters.
58+
59+
**Example:**
60+
```php
61+
$usage = $client->api('copilotUsage')->enterpriseUsageSummary('KnpLabs');
62+
```
63+
64+
### Enterprise Team Usage Summary
65+
66+
Retrieve the usage summary for a specific team within an enterprise.
67+
68+
**Method:** `GET`
69+
70+
**Endpoint:** `/enterprises/{enterprise}/team/{team}/copilot/usage`
71+
72+
**Parameters:**
73+
- `enterprise` (string): The name of the enterprise.
74+
- `team` (string): The name of the team.
75+
- `params` (array, optional): Additional query parameters.
76+
77+
**Example:**
78+
```php
79+
$usage = $client->api('copilotUsage')->enterpriseTeamUsageSummary('KnpLabs', 'developers');
80+
```
Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
## Organization / Webhooks API
2+
[Back to the navigation](../README.md)
3+
4+
Listing, showing, assigning, and removing orgniazationroles.
5+
Wraps [GitHub Organization Roles API](https://docs.github.com/en/rest/orgs/organization-roles).
6+
7+
Additional APIs:
8+
* [Organization](../doc/organization)
9+
10+
### List all organizaton roles in an organization
11+
12+
> Requires [authentication](../security.md).
13+
14+
```php
15+
$roles = $client->organization()->organizationRoles()->all('acme');
16+
```
17+
18+
Returns a counter and a list of organization roles in the organization.
19+
20+
### Get an organization role in an organization
21+
22+
> Requires [authentication](../security.md).
23+
24+
```php
25+
$role = $client->organization()->organizationRoles()->show('acme', 123);
26+
```
27+
28+
Returns a single organization role in the organization.
29+
30+
### List all teams with role assigned in an organization
31+
32+
> Requires [authentication](../security.md).
33+
34+
```php
35+
$users = $client->organization()->organizationRoles()->listTeamsWithRole('acme', 1);
36+
```
37+
38+
Returns a list of teams with the role assigned to them.
39+
40+
### Assign a single role to a team in an organization
41+
42+
> Requires [authentication](../security.md).
43+
44+
```php
45+
$client->organization()->organizationRoles()->assignRoleToTeam('acme', 1, 'admin-user');
46+
```
47+
48+
No content is returned.
49+
50+
### Remove a single role from a team in an organization
51+
52+
> Requires [authentication](../security.md).
53+
54+
```php
55+
$client->organization()->organizationRoles()->removeRoleFromTeam('acme', 1, 'admin-team');
56+
```
57+
58+
No content is returned.
59+
60+
### Remove all roles from a team in an organization
61+
62+
> Requires [authentication](../security.md).
63+
64+
```php
65+
$client->organization()->organizationRoles()->removeAllRolesFromTeam('acme', 'admin-team');
66+
```
67+
68+
No content is returned.
69+
70+
### List all users with role assigned in an organization
71+
72+
> Requires [authentication](../security.md).
73+
74+
```php
75+
$users = $client->organization()->organizationRoles()->listUsersWithRole('acme', 1);
76+
```
77+
78+
Returns a list of users with the role assigned to them.
79+
80+
### Assign a single role to a user in an organization
81+
82+
> Requires [authentication](../security.md).
83+
84+
```php
85+
$client->organization()->organizationRoles()->assignRoleToUser('acme', 1, 'admin-user');
86+
```
87+
88+
No content is returned.
89+
90+
### Remove a single role from a user in an organization
91+
92+
> Requires [authentication](../security.md).
93+
94+
```php
95+
$client->organization()->organizationRoles()->removeRoleFromUser('acme', 1, 'admin-user');
96+
```
97+
98+
No content is returned.
99+
100+
### Remove all roles from a user in an organization
101+
102+
> Requires [authentication](../security.md).
103+
104+
```php
105+
$client->organization()->organizationRoles()->removeAllRolesFromUser('acme', 'admin-user');
106+
```
107+
108+
No content is returned.

doc/repo/check_runs.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,10 @@ $params = [/*...*/];
6262
$checks = $client->api('repo')->checkRuns()->allForReference('KnpLabs', 'php-github-api', $reference, $params);
6363
```
6464

65+
### Rerequest a check run
6566

67+
https://docs.github.com/en/rest/reference/checks#rerequest-a-check-run
6668

67-
69+
```php
70+
$checks = $client->api('repo')->checkRuns()->rerequest('KnpLabs', 'php-github-api', $checkRunId);
71+
```

lib/Github/Api/Copilot/Usage.php

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?php
2+
3+
namespace Github\Api\Copilot;
4+
5+
use Github\Api\AbstractApi;
6+
7+
class Usage extends AbstractApi
8+
{
9+
public function orgUsageSummary(string $organization, array $params = []): array
10+
{
11+
return $this->get('/orgs/'.rawurlencode($organization).'/copilot/usage', $params);
12+
}
13+
14+
public function orgTeamUsageSummary(string $organization, string $teamSlug, array $params = []): array
15+
{
16+
return $this->get(
17+
'/orgs/'.rawurlencode($organization).'/team/'.rawurlencode($teamSlug).'/copilot/usage',
18+
$params
19+
);
20+
}
21+
22+
public function enterpriseUsageSummary(string $enterprise, array $params = []): array
23+
{
24+
return $this->get('/enterprises/'.rawurlencode($enterprise).'/copilot/usage', $params);
25+
}
26+
27+
public function enterpriseTeamUsageSummary(string $enterprise, string $teamSlug, array $params = []): array
28+
{
29+
return $this->get(
30+
'/enterprises/'.rawurlencode($enterprise).'/team/'.rawurlencode($teamSlug).'/copilot/usage',
31+
$params
32+
);
33+
}
34+
}

lib/Github/Api/Issue/Labels.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ public function deleteLabel($username, $repository, $label)
108108
public function update($username, $repository, $label, $newName, $color)
109109
{
110110
$params = [
111-
'name' => $newName,
111+
'name' => $newName,
112112
'color' => $color,
113113
];
114114

lib/Github/Api/Issue/Milestones.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ public function all($username, $repository, array $params = [])
3636
}
3737

3838
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/milestones', array_merge([
39-
'page' => 1,
40-
'state' => 'open',
41-
'sort' => 'due_date',
39+
'page' => 1,
40+
'state' => 'open',
41+
'sort' => 'due_date',
4242
'direction' => 'asc',
4343
], $params));
4444
}

0 commit comments

Comments
 (0)