Skip to content

Commit f788d19

Browse files
authored
[11.9] Add support for access_level in Projects::createProjectAccessToken (#731)
1 parent 1e3d007 commit f788d19

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

src/Api/Projects.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1468,6 +1468,7 @@ public function projectAccessToken($project_id, $token_id)
14681468
*
14691469
* @var string $name the name of the project access token
14701470
* @var array $scopes the scopes, one or many of: api, read_api, read_registry, write_registry, read_repository, write_repository
1471+
* @var int $access_level the access level: 10 (Guest), 20 (Reporter), 30 (Developer), 40 (Maintainer), 50 (Owner)
14711472
* @var \DateTimeInterface $expires_at the token expires at midnight UTC on that date
14721473
* }
14731474
*
@@ -1499,6 +1500,11 @@ public function createProjectAccessToken($project_id, array $parameters = [])
14991500
})
15001501
;
15011502

1503+
$resolver->setDefined('access_level')
1504+
->setAllowedTypes('access_level', 'int')
1505+
->setAllowedValues('access_level', [10, 20, 30, 40, 50])
1506+
;
1507+
15021508
$resolver->setDefined('expires_at')
15031509
->setAllowedTypes('expires_at', \DateTimeInterface::class)
15041510
->setNormalizer('expires_at', $datetimeNormalizer)

tests/Api/ProjectsTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2735,6 +2735,7 @@ public function shouldCreateProjectAccessToken(): void
27352735
'api',
27362736
'read_repository',
27372737
],
2738+
'access_level' => 30,
27382739
'expires_at' => '2021-01-31',
27392740
]
27402741
)

0 commit comments

Comments
 (0)