Documentation ¶
Index ¶
- Constants
- Variables
- func GetFavicon(URL *url.URL) (string, error)
- func NewGitHubAvatar(iType, input string) (*githubAvatar, error)
- func NewGitLabAvatar(iType, input string) (*gitlabAvatar, error)
- func NewGravatar(email string) (*gravatar, error)
- func NewImage(inputs ...string) (*gravatar, error)
- type Avatar
Constants ¶
const ( RatingG rating = iota RatingPG RatingR RatingX )
const GH_HOSTNAME = "https://avatars.githubusercontent.com"
const GH_MAX_SIZE = 460
const GL_HOSTNAME = "https://gitlab.com"
const GL_MAX_SIZE = 200
const GR_HOSTNAME = "https://www.gravatar.com"
const GR_MAX_SIZE = 2048
Variables ¶
var ErrNotFound = errors.New("A favicon was not found.")
Functions ¶
func GetFavicon ¶ added in v0.6.0
* Finds and returns a URL to a favicon. The favicon is searched for on the * hostname provided. Currently will return only the very first favicon found * regardless of size, filetype, etc. * * For now this fuction only checks for favicons at the root of the website.
func NewGitHubAvatar ¶
Return a new GitHub profile this isn't complete for tokens yet
func NewGitLabAvatar ¶ added in v0.5.0
func NewGravatar ¶
* Retrieve a Gravatar image by email address.
Types ¶
type Avatar ¶
type Avatar interface { IsDefault() bool SetDefault(string) error SetSize(int16) error URL() (*url.URL, error) // contains filtered or unexported methods }
* An avatar is an image that represents a user. This is an interface that is * fulfilled by back provider. Current providers are Gravatar and GitHub. * * a size of '0' means default size, '-1' means max size.
func NewAvatar ¶
* Returns a new avatar to be display in an app via an image URL. This * function accepts one or more 'inputs' that are to be processed by a * provider. The provider is determined by the format of the input. These are * the possibilities: * * `example@email.com` - Gravatar - email address * `ghp_someSortOfToken` - GitHub - API token * `gh:someUsername` - GitHub - username * `ghi:12345678` - GitHub - user ID * `glpat-someSortOfToken` - GitLab - API token * `gl:someUsername` - GitLab - username