auth

Paddy 2015-12-14 Parent:b7e685839a1b

182:cd5f07f9811b Go to Latest

auth/client/login.go

Update nsq import path. go-nsq has moved to nsqio/go-nsq, so we need to update the import path appropriately.

History
1 package client
3 import (
4 "code.secondbit.org/auth.hg"
5 "code.secondbit.org/scopes.hg/types"
6 )
8 func (c *Client) GetLogin(value string) (auth.Login, error) {
9 resp, err := c.Get("/logins/"+value, scopeTypes.Scopes{auth.ScopeLoginAdmin}.Strings(), nil)
10 if err != nil {
11 hErr, ok := err.(httpErrors)
12 if ok && hErr[0].Slug == auth.RequestErrNotFound {
13 return auth.Login{}, auth.ErrLoginNotFound
14 }
15 return auth.Login{}, err
16 }
17 if len(resp.Logins) < 1 {
18 return auth.Login{}, auth.ErrLoginNotFound
19 }
20 return resp.Logins[0], nil
21 }