Skip to content

Commit

Permalink
xanzy#1210 add WithToken for change token
Browse files Browse the repository at this point in the history
  • Loading branch information
Алексей Волегов authored and gravis committed Sep 1, 2022
1 parent 3a8e6a2 commit 3c87844
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions gitlab.go
Original file line number Diff line number Diff line change
Expand Up @@ -834,3 +834,14 @@ func parseError(raw interface{}) string {
return fmt.Sprintf("failed to parse unexpected error type: %T", raw)
}
}

// WithToken сhanges the token, but does not change the authorization method.
// For change authorization method create new Client.
func (c *Client) WithToken(token string) *Client {
c.tokenLock.Lock()
defer c.tokenLock.Unlock()

c.token = token

return c
}

0 comments on commit 3c87844

Please sign in to comment.