Open NathanCheshire opened 1 year ago
https://en.gravatar.com/site/implement/hash/ instructions for hash. Link to documentation in source code so that if people want to PR, they know where an assumption originally came from.
/**
* A url parameter for a Gravatar request.
*/
public enum GravatarParameter {
/**
* The hash for a Gravatar request.
*/
HASH(true),
/**
* The size of the image to be returned.
*/
SIZE,
/**
* The URL to the default image to return in the case of a hash lookup failure.
*/
DEFAULT_URL,
/**
* Whether to force the default url regardless of whether the hash can be located.
*/
FORCE_DEFAULT,
/**
* The {@link GravatarDefaultPreset} type. Used to return a random custom avatar if a hash cannot be located.
*/
DEFAULT_PRESET,
/**
* The default image URL a Gravatar request.
*/
DEFAULT_IMAGE_URL,
/**
* The {@link GravatarRating} for a Gravatar request.
*/
RATING;
/**
* Whether this URL parameter is required for a Gravatar request.
*/
private final boolean required;
GravatarParameter() {
this(false);
}
GravatarParameter(boolean required) {
this.required = required;
}
}
https://en.gravatar.com/205e460b479e2e5b48aec07710c08d50.json can also get json data about a user https://en.gravatar.com/site/implement/profiles/ for more information
JGravatar
library for interaction with Gravatar.com is a bit outdated. We could make our own library separate from Cyder and pull it in with Gradle. Then others could easily use it, submit PRs, etc.Notes: Use builder pattern for API parameters https://www.gravatar.com/avatar/HASH .jpg sometimes required default size is 80x80, allow customizing with config ?s=200 1-2048px range is valid can supply own url to default image: ?d=https%3A%2F%2Fexample.com%2Fimages%2Favatar.jpg d=404,mp,identicon,monsterid,wavatar,retro,robohash,blank are also valid options force default image to always load: ?f=y ratings: g, pg, r, x, can combine: g or pg use ?r=pg