Skip to content

Instantly share code, notes, and snippets.

@harlow
Last active March 11, 2017 23:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save harlow/6b597eb07bb6ad4b766037a8527b8483 to your computer and use it in GitHub Desktop.
Save harlow/6b597eb07bb6ad4b766037a8527b8483 to your computer and use it in GitHub Desktop.
Struct w/ return vals from Aboutme API
// if "name" is returned as `[]` in JSON payload the json.Unmarshal func will panic in Golang
// Name struct {
// GivenName string `json:"givenName"`
// FamilyName string `json:"familyName"`
// Formatted string `json:"formatted"`
// } `json:"name"`
type Profile struct {
ID string `json:"id"`
Hash string `json:"hash"`
RequestHash string `json:"requestHash"`
ProfileURL string `json:"profileUrl"`
PreferredUsername string `json:"preferredUsername"`
ThumbnailURL string `json:"thumbnailUrl"`
DefaultAvatar bool `json:"defaultAvatar"`
Photos []struct {
Value string `json:"value"`
Type string `json:"type"`
} `json:"photos"`
Name struct {
GivenName string `json:"givenName"`
FamilyName string `json:"familyName"`
Formatted string `json:"formatted"`
} `json:"name"`
DisplayName string `json:"displayName"`
CurrentLocation string `json:"currentLocation"`
Accounts []struct {
Domain string `json:"domain"`
Display string `json:"display"`
URL string `json:"url"`
Username string `json:"username"`
Verified string `json:"verified"`
Shortname string `json:"shortname"`
} `json:"accounts"`
Urls []struct {
Value string `json:"value"`
Title string `json:"title"`
} `json:"urls"`
}
{
"entry": [{
"id": "24093338",
"hash": "f5a714266c7ea5ea163cddc8d30bc53e",
"requestHash": "569fd44396d10a2f3aefb7b868e5e322",
"profileUrl": "http:\/\/gravatar.com\/oniiru",
"preferredUsername": "oniiru",
"thumbnailUrl": "https:\/\/secure.gravatar.com\/avatar\/f5a714266c7ea5ea163cddc8d30bc53e",
"photos": [{
"value": "https:\/\/secure.gravatar.com\/avatar\/f5a714266c7ea5ea163cddc8d30bc53e",
"type": "thumbnail"
}],
"name": [],
"displayName": "oniiru",
"urls": []
}]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment