//Retrieves the url of the blog's avatar.
//size can be: 16, 24, 30, 40, 48, 64, 96, 128 or 512.
978989
func (trc *TumblrRestClient) Avatar(blogname string, size int) AvatarResponse {
	requestUrl := trc.request.host + fmt.Sprintf("/v2/blog/%s/avatar/%d", blogname, size)
	httpRequest, err := http.NewRequest("GET", requestUrl, nil)
	if err != nil {
		fmt.Println(err)
	}
	transport := &http.Transport{}
	httpResponse, err2 := transport.RoundTrip(httpRequest)
	if err2 != nil {
		fmt.Println(err2)
	}
	defer httpResponse.Body.Close()
	body, err3 := ioutil.ReadAll(httpResponse.Body)
	if err3 != nil {
		fmt.Println(err3)
	}
	data := trc.request.JSONParse(body)
	var result AvatarResponse
	json.Unmarshal(data.Response, &result)
	return result
}
763744
func (p *PullRequestComment) GetURL() string {
	if p == nil || p.URL == nil {
		return ""
	}
	return *p.URL
}
1123630
func (item *OrderItem) ProductImageURL() string {
	item.loadSizeVariation()
	return item.SizeVariation.ColorVariation.MainImageURL()
}
893104
func (i *Image) getResponseFromURL(u string) (*http.Response, error) {
	req, err := http.NewRequest("GET", u, nil)
	if err != nil {
		return nil, err
	}
	req.Header.Set("Authorization", "Token "+i.token)

	res, err := i.client.Do(req)
	if err != nil {
		return nil, err
	}

	if res.StatusCode != http.StatusOK {
		defer res.Body.Close()
		type errorMsg struct {
			Error string `json:"error"`
		}

		var errMsg errorMsg
		if err := json.NewDecoder(res.Body).Decode(&errMsg); err == nil {
			return nil, fmt.Errorf("%s: HTTP %d - %s", u, res.StatusCode, errMsg.Error)
		}

		return nil, fmt.Errorf("%s: HTTP %d", u, res.StatusCode)
	}

	return res, nil
}
860608
func (f *HttpFile) Size() int64 {
	DebugLog(f.Debug).Println("Size", f.len)
	return f.len
}
1063319
func (c *CommitsComparison) GetHTMLURL() string {
	if c == nil || c.HTMLURL == nil {
		return ""
	}
	return *c.HTMLURL
}
883093
func Url() string {
	n := intRange(0, 3)

	base := `http://www.` + Host()

	switch n {
	case 0:
		break
	case 1:
		base += "/" + Word(2, 8)
	case 2:
		base += "/" + Word(2, 8) + "/" + Word(2, 8) + ".html"
	}
	return base
}
1085902
func (g *GistComment) GetURL() string {
	if g == nil || g.URL == nil {
		return ""
	}
	return *g.URL
}
781788
func (c *Client) Get(endpoint string) (tumblr.Response, error) {
	return c.GetWithParams(endpoint, url.Values{})
}
943883
func (c *FlickrClient) GetUrl() string {
	return fmt.Sprintf("%s?%s", c.EndpointUrl, c.Args.Encode())
}
895562
func (c *Client) GetMetadataURL(id, edition, version string) string {
	return fmt.Sprintf("%s/datasets/%s/editions/%s/versions/%s/metadata", c.url, id, edition, version)
}
1196849
func (i *IssueComment) GetHTMLURL() string {
	if i == nil || i.HTMLURL == nil {
		return ""
	}
	return *i.HTMLURL
}
278202
func (r *RepositoryRelease) GetHTMLURL() string {
	if r == nil || r.HTMLURL == nil {
		return ""
	}
	return *r.HTMLURL
}
809279
func (c *Config) ContainerImageMetadataURL() (string, bool) {
	if url, ok := c.defined[ContainerImageMetadataURLKey]; ok && url != "" {
		return url.(string), true
	}
	return "", false
}
1262556
func (internet Internet) URL(v reflect.Value) (interface{}, error) {
	return internet.url(), nil
}
501569
func (b *SearchRequestBuilder) Size(size int) *SearchRequestBuilder {
	b.size = size
	return b
}
859170
func GetGravatar(id string, size int, dtype AvatarType) string {
	h := md5.New()
	h.Write([]byte(id))
	sum := h.Sum(nil)
	return fmt.Sprintf("https://secure.gravatar.com/avatar/%x?s=%d&d=%s", sum, size, dtype)
}