MCPcopy Index your code
hub / github.com/dearcode/candy / getUserInfoByName

Method getUserInfoByName

client/candy.go:183–196  ·  view source on GitHub ↗
(user string)

Source from the content-addressed store, hash-verified

181}
182
183func (c *CandyClient) getUserInfoByName(user string) (*UserInfo, error) {
184 if code, err := CheckUserName(user); err != nil {
185 return nil, NewError(code, err.Error())
186 }
187
188 req := &meta.GateGetUserInfoRequest{Type: 0, UserName: user}
189 resp, err := c.api.GetUserInfo(context.Background(), req)
190 if err != nil {
191 return nil, err
192 }
193
194 userInfo := &UserInfo{ID: resp.ID, Name: resp.User, NickName: resp.NickName, Avatar: resp.Avatar}
195 return userInfo, resp.Header.Error()
196}
197
198// GetUserInfoByID 根据用户ID获取用户信息
199//TODO 需要把返回字符串修改成对应的类型

Callers 2

GetUserInfoByNameMethod · 0.95
FindUserMethod · 0.95

Calls 4

CheckUserNameFunction · 0.85
NewErrorFunction · 0.85
GetUserInfoMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected