feat: Run API call as another user

This commit is contained in:
Michael Gerdemann
2020-01-19 12:40:08 +01:00
parent eeb2655889
commit d527b06af7
2 changed files with 17 additions and 0 deletions

View File

@ -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

View File

@ -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,