libravatar

package module
v0.0.0-...-33a7521 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2019 License: MIT Imports: 10 Imported by: 27 modules, 25 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

Simple golang library for serving federated avatars

[trunk] (https://goreportcard.com/report/strk.kbt.io/projects/go/libravatar)

Use

go get strk.kbt.io/projects/go/libravatar
cd $GOPATH/src/strk.kbt.io/projects/go/libravatar
go doc

Contribute

A clone of the code repository would be downloaded by go get. You can send patches or pull requests to strk@kbt.io.

If you need a place to publish your contribution branches, you could start from a fork of the gitlab mirror: https://gitlab.com/strk/go-libravatar

Contacts

Documentation

Index

Constants

View Source
const (
	// Do not load any image if none is associated with the email
	// hash, instead return an HTTP 404 (File Not Found) response
	HTTP404 = "404"
	// (mystery-man) a simple, cartoon-style silhouetted outline of
	// a person (does not vary by email hash)
	MysteryMan = "mm"
	// a geometric pattern based on an email hash
	IdentIcon = "identicon"
	// a generated 'monster' with different colors, faces, etc
	MonsterID = "monsterid"
	// generated faces with differing features and backgrounds
	Wavatar = "wavatar"
	// awesome generated, 8-bit arcade-style pixelated faces
	Retro = "retro"
)

Default images (to be used as defaultURL)

Variables

View Source
var (
	// DefaultLibravatar is a default Libravatar object,
	// enabling object-less function calls
	DefaultLibravatar = New()
)

Functions

func FromEmail

func FromEmail(email string) (string, error)

FromEmail is the object-less call to DefaultLibravatar for an email adders

func FromURL

func FromURL(openid string) (string, error)

FromURL is the object-less call to DefaultLibravatar for a URL

Types

type Libravatar

type Libravatar struct {
	// contains filtered or unexported fields
}

Libravatar is an opaque structure holding service configuration

func New

func New() *Libravatar

New instanciates a new Libravatar object (handle)

func (*Libravatar) FromEmail

func (v *Libravatar) FromEmail(email string) (string, error)

FromEmail returns the url of the avatar for the given email

func (*Libravatar) FromURL

func (v *Libravatar) FromURL(openid string) (string, error)

FromURL returns the url of the avatar for the given url (typically for OpenID)

func (*Libravatar) SetAvatarSize

func (v *Libravatar) SetAvatarSize(size uint)

SetAvatarSize sets avatars image dimension (0 for default)

func (*Libravatar) SetFallbackHost

func (v *Libravatar) SetFallbackHost(host string)

SetFallbackHost sets the hostname for fallbacks in case no avatar service is defined for a domain

func (*Libravatar) SetSecureFallbackHost

func (v *Libravatar) SetSecureFallbackHost(host string)

SetSecureFallbackHost sets the hostname for fallbacks in case no avatar service is defined for a domain, when requiring secure domains

func (*Libravatar) SetUseHTTPS

func (v *Libravatar) SetUseHTTPS(use bool)

SetUseHTTPS sets flag requesting use of https for fetching avatars

Jump to

Keyboard shortcuts

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