gravago

package module
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2018 License: BSD-2-Clause Imports: 5 Imported by: 0

README

Gravago - Gravatar library for Go

Simple go library for creating gravatar.com avatar URLs

Current version: 0.4.0

Credits

This library has some inspiration from the eefret/gravatar Go library and the node-gravatar Node.js library.

Table of Contents
  1. Overview
  2. Installation - Getting this package ready to roll
  3. Usage - How to use this thing
  4. License - Licensing information
  5. Contact - How to contact me

Installation

Just like any other Go package, you can install this baby with go get ...

go get github.com/Ascendings/gravago

Usage

Now for the fun stuff... the meat! Seriously, though, this package isn't designed to be too difficult to use in a web application - just create a new instance, fiddle some options, then generate your URL!

For example:

// of course we need to import this package
import "github.com/Ascendings/gravago"

// create a new instance
grav := gravago.New(gravago.GravatarOptions{
  ForceHTTPS: true,
  IconSet: "mosterid",
  IconRating: "x",
  IconSize: 80,
})

// change some options later on...
grav.SetSize(80) // set the icon size to 80
grav.SetIcons("monsterid") // use monsterid default icons
grav.SetRating("x") // allow x-rated icons
grav.UseHTTPS(true) // force HTTPS

// generate URL
gravURL := grav.URL("myemail@example.com")

License

This package/program is licensed under the 2-Clause BSD License

Contact

Email me at: brotherballantine@gmail.com

Feel free to hit me up at

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Gravatar added in v0.3.1

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

Gravatar - gravatar object

func New

func New(opts GravatarOptions) *Gravatar

New - create new gravatar object instance

func (*Gravatar) GetURL added in v0.4.0

func (g *Gravatar) GetURL(email string) string

GetURL - generate gravatar URL string

func (*Gravatar) SetIcons added in v0.3.1

func (g *Gravatar) SetIcons(iconset string)

SetIcons - set the default icon to return

func (*Gravatar) SetRating added in v0.3.1

func (g *Gravatar) SetRating(rating string)

SetRating - set rating

func (*Gravatar) SetSize added in v0.3.1

func (g *Gravatar) SetSize(size int)

SetSize - set size of gravatar image

func (*Gravatar) UseHTTPS added in v0.3.1

func (g *Gravatar) UseHTTPS(protocol bool)

UseHTTPS - force using HTTPS protocol

type GravatarOptions added in v0.4.0

type GravatarOptions struct {
	ForceHTTPS bool
	IconSet    string
	IconRating string
	IconSize   int
}

GravatarOptions - gravatar struct settings

Jump to

Keyboard shortcuts

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