gpic

package
v0.7.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 12, 2023 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RatingG rating = iota
	RatingPG
	RatingR
	RatingX
)
View Source
const GH_HOSTNAME = "https://avatars.githubusercontent.com"
View Source
const GH_MAX_SIZE = 460
View Source
const GL_HOSTNAME = "https://gitlab.com"
View Source
const GL_MAX_SIZE = 200
View Source
const GR_HOSTNAME = "https://www.gravatar.com"
View Source
const GR_MAX_SIZE = 2048

Variables

View Source
var ErrNotFound = errors.New("A favicon was not found.")

Functions

func GetFavicon added in v0.6.0

func GetFavicon(URL *url.URL) (string, error)

* 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

func NewGitHubAvatar(iType, input string) (*githubAvatar, error)

Return a new GitHub profile this isn't complete for tokens yet

func NewGitLabAvatar added in v0.5.0

func NewGitLabAvatar(iType, input string) (*gitlabAvatar, error)

func NewGravatar

func NewGravatar(email string) (*gravatar, error)

* Retrieve a Gravatar image by email address.

func NewImage

func NewImage(inputs ...string) (*gravatar, error)

Original entrypoint into this module. Only supports Gravatar. This function * is deprecated and will go away before the 1.0 release. Instead, the new * NewAvatar function should be used instead.

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

func NewAvatar(inputs ...string) (Avatar, error)

* 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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL