當前位置: 首頁>>代碼示例>>Golang>>正文


Golang User.Email方法代碼示例

本文整理匯總了Golang中github.com/laicosly/goth.User.Email方法的典型用法代碼示例。如果您正苦於以下問題:Golang User.Email方法的具體用法?Golang User.Email怎麽用?Golang User.Email使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在github.com/laicosly/goth.User的用法示例。


在下文中一共展示了User.Email方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: userFromReader

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
}
開發者ID:laicosly,項目名稱:goth,代碼行數:25,代碼來源:wordpress.go

示例2: userFromReader

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
}
開發者ID:laicosly,項目名稱:goth,代碼行數:32,代碼來源:yo.go

示例3: userFromReader

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
}
開發者ID:laicosly,項目名稱:goth,代碼行數:29,代碼來源:linkedin.go

示例4: userFromReader

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
}
開發者ID:laicosly,項目名稱:goth,代碼行數:25,代碼來源:github.go

示例5: userFromReader

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
}
開發者ID:laicosly,項目名稱:goth,代碼行數:25,代碼來源:spotify.go

示例6: userFromReader

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
}
開發者ID:laicosly,項目名稱:goth,代碼行數:21,代碼來源:dropbox.go


注:本文中的github.com/laicosly/goth.User.Email方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。