Skip to content
Closed
Changes from all commits
Commits
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
25 changes: 25 additions & 0 deletions src/Api/Projects.php
Original file line number Diff line number Diff line change
Expand Up @@ -1704,6 +1704,31 @@ public function createProjectAccessToken($project_id, array $parameters = [])
return $this->post($this->getProjectPath($project_id, 'access_tokens'), $resolver->resolve($parameters));
}

/**
* @param int|string $project_id
* @param int $token_id
* @param array $parameters {
*
* @var \DateTimeInterface $expires_at the token expires at midnight UTC on that date
* }
*
* @return mixed
*/
public function rotateProjectAccessToken($project_id, int $token_id, array $parameters = [])

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

{
$resolver = $this->createOptionsResolver();
$datetimeNormalizer = function (Options $resolver, \DateTimeInterface $value): string {
return $value->format('Y-m-d');
};

$resolver->setDefined('expires_at')
->setAllowedTypes('expires_at', \DateTimeInterface::class)
->setNormalizer('expires_at', $datetimeNormalizer)
;

return $this->post($this->getProjectPath($project_id, 'access_tokens/'.$token_id.'/rotate'), $resolver->resolve($parameters));
}

/**
* @param int|string $project_id
* @param int|string $token_id
Expand Down