// GetDownloadURL returns the DownloadURL field if it's non-nil, zero value otherwise.
332584
func (r *RepositoryLicense) GetDownloadURL() string {
	if r == nil || r.DownloadURL == nil {
		return ""
	}
	return *r.DownloadURL
}
895859
func (r *RepositoryRelease) GetZipballURL() string {
	if r == nil || r.ZipballURL == nil {
		return ""
	}
	return *r.ZipballURL
}
395245
func NewHTTPDownloadRequest(resourceName string) (*http.Request, error) {
	return http.NewRequest("GET", "/resources/"+resourceName, nil)
}
659927
func (p *PullRequestReview) GetPullRequestURL() string {
	if p == nil || p.PullRequestURL == nil {
		return ""
	}
	return *p.PullRequestURL
}
1264567
func (d *downloader) DownloadFile(url string) (int64, string, error) {
	c := http.Client{
		CheckRedirect: func(r *http.Request, via []*http.Request) error {
			r.URL.Opaque = r.URL.Path

			//some redirect return '/' as url
			if strings.Trim(r.URL.Opaque, "/") != "" {
				url = r.URL.Opaque
			}

			return nil
		},
	}

	r, err := c.Get(url)

	if err != nil {
		return 0, "", err
	}
	defer r.Body.Close()

	if r.StatusCode == 200 {
		d.filename = getFilenameFromHeader(r.Header.Get("Content-Disposition"))

		if d.filename == "" {
			d.filename = getFilenameFromURL(url)
		}

		f, err := os.Create(filepath.Join(d.saveDir, d.filename))
		if err != nil {
			return 0, "", err
		}
		defer f.Close()

		size, err := io.Copy(f, r.Body)
		if err != nil {
			return 0, "", err
		}

		d.downloaded = true
		return size, d.filename, nil

	}
	return 0, "", fmt.Errorf("Error downloading file from %s", url)
}
1330140
func (r *RepositoryComment) GetURL() string {
	if r == nil || r.URL == nil {
		return ""
	}
	return *r.URL
}
734259
func (c *CommitFile) GetBlobURL() string {
	if c == nil || c.BlobURL == nil {
		return ""
	}
	return *c.BlobURL
}
1121292
func (s *ExportProjectOutput) SetDownloadUrl(v string) *ExportProjectOutput {
	s.DownloadUrl = &v
	return s
}
343093
func (g *GitObject) GetURL() string {
	if g == nil || g.URL == nil {
		return ""
	}
	return *g.URL
}
1156426
func (r *RepositoryInvitation) GetHTMLURL() string {
	if r == nil || r.HTMLURL == nil {
		return ""
	}
	return *r.HTMLURL
}
278202
func (r *RepositoryRelease) GetHTMLURL() string {
	if r == nil || r.HTMLURL == nil {
		return ""
	}
	return *r.HTMLURL
}
635332
func (r *RepositoryContent) GetGitURL() string {
	if r == nil || r.GitURL == nil {
		return ""
	}
	return *r.GitURL
}
738860
func (r *ReleaseAsset) GetURL() string {
	if r == nil || r.URL == nil {
		return ""
	}
	return *r.URL
}
716509
func (c *Commit) GetHTMLURL() string {
	if c == nil || c.HTMLURL == nil {
		return ""
	}
	return *c.HTMLURL
}
119689
func (r *ReleaseAsset) GetBrowserDownloadURL() string {
	if r == nil || r.BrowserDownloadURL == nil {
		return ""
	}
	return *r.BrowserDownloadURL
}
611183
func (c *CommitResult) GetURL() string {
	if c == nil || c.URL == nil {
		return ""
	}
	return *c.URL
}
886387
func (d *Deployment) GetURL() string {
	if d == nil || d.URL == nil {
		return ""
	}
	return *d.URL
}