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 pdecat committed Jan 23, 2022
1 parent 3be3536 commit 9816322
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 9816322

Please sign in to comment.