// User search by username
165276
func (search *Search) User(user string) (*SearchResult, error) {
	insta := search.inst
	body, err := insta.sendRequest(
		&reqOptions{
			Endpoint: urlSearchUser,
			Query: map[string]string{
				"ig_sig_key_version": goInstaSigKeyVersion,
				"is_typeahead":       "true",
				"query":              user,
				"rank_token":         insta.rankToken,
			},
		},
	)
	if err != nil {
		return nil, err
	}

	res := &SearchResult{}
	err = json.Unmarshal(body, res)
	return res, err
}
1277070
func (c *Crowd) GetUser(user string) (User, error) {
	u := User{}

	v := url.Values{}
	v.Set("username", user)
	url := c.url + "rest/usermanagement/1/user?" + v.Encode()
	c.Client.Jar = c.cookies
	req, err := http.NewRequest("GET", url, nil)
	if err != nil {
		return u, err
	}
	req.SetBasicAuth(c.user, c.passwd)
	req.Header.Set("Accept", "application/xml")
	req.Header.Set("Content-Type", "application/xml")
	resp, err := c.Client.Do(req)
	if err != nil {
		return u, err
	}
	defer resp.Body.Close()

	switch resp.StatusCode {
	case 404:
		return u, fmt.Errorf("user not found")
	case 200:
		// fall through switch without returning
	default:
		return u, fmt.Errorf("request failed: %s", resp.Status)
	}

	body, err := ioutil.ReadAll(resp.Body)
	if err != nil {
		return u, err
	}

	err = xml.Unmarshal(body, &u)
	if err != nil {
		return u, err
	}

	return u, nil
}
830584
func (sl *Slack) FindImByName(name string) (*Im, error) {
	user, err := sl.FindUserByName(name)
	if err != nil {
		return nil, err
	}
	id := user.Id
	return sl.FindIm(func(im *Im) bool {
		return im.User == id
	})
}
763907
func (s *userService) GetByUsernameAndPassword(username, userPassword string) (datamodels.User, bool) {
	if username == "" || userPassword == "" {
		return datamodels.User{}, false
	}

	return s.repo.Select(func(m datamodels.User) bool {
		if m.Username == username {
			hashed := m.HashedPassword
			if ok, _ := datamodels.ValidatePassword(userPassword, hashed); ok {
				return true
			}
		}
		return false
	})
}
127459
func (conn *Conn) User(ident, name string) {
	conn.Raw(USER + " " + ident + " 12 * :" + name)
}
791814
func (i *Instagram) SearchUsers(query string) (*SearchUsers, error) {

	endpoint := APIURL + "/users/search/?ig_sig_key_version=" + SIGKEYVERSION +
		"&is_typeahead=true&query=" + query + "&rank_token=" + i.rankToken

	resp, err := i.request("GET", endpoint, nil)
	if err != nil {
		return nil, err
	}

	var object *SearchUsers
	err = json.Unmarshal(resp, &object)
	if err != nil {
		return nil, err
	}

	return object, nil
}
252540
func (c *ExampleService) FindUserByName(ctx context.Context, n string) (*platform.User, error) {
	var u *platform.User

	err := c.kv.View(func(tx Tx) error {
		usr, err := c.findUserByName(ctx, tx, n)
		if err != nil {
			return err
		}
		u = usr
		return nil
	})

	return u, err
}
630413
func (b SqlAuthBackend) User(username string) (user UserData, e error) {
	row := b.userStmt.QueryRow(username)
	err := row.Scan(&user.Email, &user.Hash, &user.Role)
	if err != nil {
		if err == sql.ErrNoRows {
			return user, ErrMissingUser
		}
		return user, mksqlerror(err.Error())
	}
	user.Username = username
	return user, nil
}
104881
func (s *Service) FindUser(ctx context.Context, filter platform.UserFilter) (*platform.User, error) {
	op := OpPrefix + platform.OpFindUser
	if filter.ID != nil {
		u, err := s.FindUserByID(ctx, *filter.ID)
		if err != nil {
			return nil, &platform.Error{
				Op:  op,
				Err: err,
			}
		}
		return u, nil
	}

	if filter.Name != nil {
		var u *platform.User

		err := s.forEachUser(ctx, func(user *platform.User) bool {
			if user.Name == *filter.Name {
				u = user
				return false
			}
			return true
		})

		if err != nil {
			return nil, err
		}

		if u == nil {
			return nil, &platform.Error{
				Code: platform.ENotFound,
				Op:   op,
				Msg:  "user not found",
			}
		}

		return u, nil
	}

	return nil, &platform.Error{
		Code: platform.EInvalid,
		Op:   op,
		Msg:  "expected filter to contain name",
	}
}
300670
func (u *CachedUPAKLoader) LookupUsername(ctx context.Context, uid keybase1.UID) (NormalizedUsername, error) {
	var empty NormalizedUsername
	uids := []keybase1.UID{uid}
	namePkgs, err := u.G().UIDMapper.MapUIDsToUsernamePackages(ctx, u.G(), uids, 0, 0, false)
	if err != nil {
		return empty, err
	}
	if len(namePkgs) == 0 {
		return empty, UserNotFoundError{UID: uid, Msg: "in CachedUPAKLoader"}
	}

	if u.TestDeadlocker != nil {
		u.TestDeadlocker()
	}

	return namePkgs[0].NormalizedUsername, nil
}
513042
func (c *Client) GetUser(username string) (rec *UserInfo, err error) {
	req, err := newGETRequest(c, "users/"+PathEscape(username))
	if err != nil {
		return nil, err
	}

	if err = executeAndParseRequest(c, req, &rec); err != nil {
		return nil, err
	}

	return rec, nil
}
850514
func GetUserByName(name string) (*User, error) {
	if len(name) == 0 {
		return nil, errors.UserNotExist{0, name}
	}
	u := &User{LowerName: strings.ToLower(name)}
	has, err := x.Get(u)
	if err != nil {
		return nil, err
	} else if !has {
		return nil, errors.UserNotExist{0, name}
	}
	return u, nil
}
992041
func (g *SearchService) Users(uri *Hyperlink, uriParams M) (userSearchResults *UserSearchResults, result *Result) {
	url, err := ExpandWithDefault(uri, &UserSearchURL, uriParams)
	if err != nil {
		return nil, &Result{Err: err}
	}

	result = g.client.get(url, &userSearchResults)
	return
}
249169
func (m *Manager) GetByUsernameAndAZP(username, azp string) (*Identifier, error) {
	var idObj Identifier

	if err := m.getIdentifierCollection().Find(bson.M{"username": username, "azp": azp}).One(&idObj); err != nil {
		return nil, err
	}

	return &idObj, nil
}
933524
func (e *Editor) User(username string, password string) *Editor {
	e.config.Username = username
	e.config.Password = password
	return e
}
853325
func (a *Config) GetUserName(c echo.Context) string {
	username, _, _ := c.Request().BasicAuth()
	return username
}
1205807
func User(ctx context.Context) string {
	userIdentity, _ := ctx.Value(UserIdentityKey).(string)
	return userIdentity
}