mirror of
https://github.com/avency/Gitea.git
synced 2025-10-29 10:42:33 +01:00
feat: Run API call as another user
This commit is contained in:
@ -88,6 +88,16 @@ class Client
|
||||
return $this->httpClient->request($method, $uri, $options);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $username
|
||||
* @return $this
|
||||
*/
|
||||
public function sudo(string $username): self
|
||||
{
|
||||
$this->config['query']['sudo'] = $username;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $authentication
|
||||
* @throws Exception
|
||||
|
||||
@ -59,6 +59,13 @@ $repository = $giteaClient->repositories()->get('owner', 'repoName');
|
||||
$repository = $giteaClient->miscellaneous()->version();
|
||||
```
|
||||
|
||||
Run an API call as another user:
|
||||
|
||||
```
|
||||
// e.g. check subscription status as a user
|
||||
$status = $giteaClient->sudo('username')->repositories()->checkSubscription();
|
||||
```
|
||||
|
||||
## Versioning
|
||||
|
||||
We use [SemVer](http://semver.org/) for versioning. For the versions available,
|
||||
|
||||
Reference in New Issue
Block a user