Skip to content

Commit

Permalink
Removed LoginType from taiga.Client
Browse files Browse the repository at this point in the history
  • Loading branch information
theriverman committed May 30, 2020
1 parent 5bcdfef commit ffaf2f2
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,6 @@ func main() {
client := taiga.Client{
BaseURL: "https://api.taiga.io",
HTTPClient: &http.Client{},
LoginType: "normal",
}

// Initialise client (authenticates to Taiga)
Expand Down
10 changes: 6 additions & 4 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ type Client struct {
BaseURL string // i.e.: "http://taiga.test" | Same value as `api` in `taiga-front-dist/dist/conf.json`
Headers *http.Header // mostly set by system
HTTPClient *http.Client // set by user
LoginType string // i.e.: "normal"; "github"; "ldap"
Token string // set by system; can be set manually
TokenType string // default=Bearer; options:Bearer,Application
Self *User // User logged in
Expand Down Expand Up @@ -105,9 +104,6 @@ func (c *Client) Initialise() error {
return fmt.Errorf("BaseURL is not set or invalid")

}
if len(c.LoginType) <= 1 {
return fmt.Errorf("LoginType is not set")
}
//Set basic token type
if len(c.TokenType) <= 1 {
c.TokenType = "Bearer"
Expand Down Expand Up @@ -152,10 +148,16 @@ func (c *Client) AuthByCredentials(credentials *Credentials) error {
if !c.isInitialised {
return fmt.Errorf("Client not initialised")
}

if len(credentials.Type) <= 1 {
return fmt.Errorf("LoginType is not set")
}

user, err := c.Auth.login(credentials)
if err != nil {
return err
}

c.Self = user.AsUser()
return nil
}
Expand Down
1 change: 0 additions & 1 deletion examples/README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ func main() {
client := taiga.Client{
BaseURL: "https://api.taiga.io",
HTTPClient: &http.Client{},
LoginType: "normal",
}
// Initialise client (authenticates to Taiga)
err := client.Initialise()
Expand Down

0 comments on commit ffaf2f2

Please sign in to comment.