func userFromReader(reader io.Reader, user *goth.User) error { u := struct { UserID int `json:"ID"` AvatarURL string `json:"avatar_URL"` Email string `json:"email"` Description string `json:"profile_URL"` Name string `json:"username"` NickName string `json:"display_name"` }{} err := json.NewDecoder(reader).Decode(&u) if err != nil { return err } user.NickName = u.NickName user.UserID = strconv.Itoa(u.UserID) user.Name = u.Name user.Description = u.Description user.AvatarURL = u.AvatarURL user.Email = u.Email return err }
func userFromReader(reader io.Reader, user *goth.User) error { u := struct { ID string `json:"id"` Email string `json:"email"` Bio string `json:"bio"` Name string `json:"name"` Link string `json:"link"` Picture struct { Data struct { URL string `json:"url"` } `json:"data"` } `json:"picture"` Location struct { Name string `json:"name"` } `json:"location"` }{} err := json.NewDecoder(reader).Decode(&u) if err != nil { return err } user.Name = u.Name user.NickName = u.Name user.Email = u.Email user.Description = u.Bio user.AvatarURL = u.Picture.Data.URL user.UserID = u.ID user.Location = u.Location.Name return err }
func userFromReader(reader io.Reader, user *goth.User) error { u := struct { ID string `json:"id"` Email string `json:"emailAddress"` FirstName string `json:"firstName"` LastName string `json:"lastName"` Headline string `json:"headline"` PictureURL string `json:"pictureUrl"` Location struct { Name string `json:"name"` } `json:"location"` }{} err := json.NewDecoder(reader).Decode(&u) if err != nil { return err } user.Name = u.FirstName + " " + u.LastName user.NickName = u.FirstName user.Email = u.Email user.Description = u.Headline user.AvatarURL = u.PictureURL user.UserID = u.ID user.Location = u.Location.Name return err }
func userFromReader(reader io.Reader, user *goth.User) error { u := struct { ID int `json:"id"` Email string `json:"email"` Bio string `json:"bio"` Name string `json:"name"` Picture string `json:"avatar_url"` Location string `json:"location"` }{} err := json.NewDecoder(reader).Decode(&u) if err != nil { return err } user.Name = u.Name user.NickName = u.Name user.Email = u.Email user.Description = u.Bio user.AvatarURL = u.Picture user.UserID = strconv.Itoa(u.ID) user.Location = u.Location return err }
func userFromReader(r io.Reader, user *goth.User) error { u := struct { Country string `json:"country"` DisplayName string `json:"display_name"` Email string `json:"email"` ID string `json:"id"` Images []struct { URL string `json:"url"` } `json:"images"` }{} err := json.NewDecoder(r).Decode(&u) if err != nil { return err } user.Name = u.DisplayName user.Email = u.Email user.UserID = u.ID user.Location = u.Country if len(u.Images) > 0 { user.AvatarURL = u.Images[0].URL } return nil }
func userFromReader(reader io.Reader, user *goth.User) error { u := struct { ID int `json:"uid"` Email string `json:"email"` Name string `json:"display_name"` Country string `json:"country"` }{} err := json.NewDecoder(reader).Decode(&u) if err != nil { return err } user.Name = u.Name user.Email = u.Email user.UserID = strconv.Itoa(u.ID) user.Location = u.Country return err }