diff --git a/CHANGELOG.md b/CHANGELOG.md index 51a0a88682379b2e98dc1b04023808e1ab8f17d3..7669ea66c9fc994f573efdb0d100bb6f528dd848 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,8 @@ `UrlBase::Instance`. * `api::RestClient::instance_endpoint` now has a default implementation of not supporting `UrlBase::Instance` endpoints. + * `ImpersonationClient` may now be switched to an OAuth2 token like the main + builder can. ## Changes diff --git a/src/gitlab.rs b/src/gitlab.rs index 695eb9b80f25a4c9770b2446280c6466e4d34757..1a7a2e51e9b3f85c6fce7283b73008893964c1cc 100644 --- a/src/gitlab.rs +++ b/src/gitlab.rs @@ -691,6 +691,14 @@ impl<'a, C> ImpersonationClient<'a, C> { client, } } + + /// Switch to using an OAuth2 token instead of a personal access token + pub fn oauth2_token(&mut self) -> &mut Self { + if let Auth::Token(auth) = self.auth.clone() { + self.auth = Auth::OAuth2(auth); + } + self + } } impl<'a, C> api::RestClient for ImpersonationClient<'a, C>