aboutsummaryrefslogtreecommitdiff
path: root/vendor/github.com/google/go-github/github/repos_traffic.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/google/go-github/github/repos_traffic.go')
-rw-r--r--vendor/github.com/google/go-github/github/repos_traffic.go21
1 files changed, 12 insertions, 9 deletions
diff --git a/vendor/github.com/google/go-github/github/repos_traffic.go b/vendor/github.com/google/go-github/github/repos_traffic.go
index 67341b9..fb1c976 100644
--- a/vendor/github.com/google/go-github/github/repos_traffic.go
+++ b/vendor/github.com/google/go-github/github/repos_traffic.go
@@ -5,7 +5,10 @@
package github
-import "fmt"
+import (
+ "context"
+ "fmt"
+)
// TrafficReferrer represent information about traffic from a referrer .
type TrafficReferrer struct {
@@ -52,7 +55,7 @@ type TrafficBreakdownOptions struct {
// ListTrafficReferrers list the top 10 referrers over the last 14 days.
//
// GitHub API docs: https://developer.github.com/v3/repos/traffic/#list-referrers
-func (s *RepositoriesService) ListTrafficReferrers(owner, repo string) ([]*TrafficReferrer, *Response, error) {
+func (s *RepositoriesService) ListTrafficReferrers(ctx context.Context, owner, repo string) ([]*TrafficReferrer, *Response, error) {
u := fmt.Sprintf("repos/%v/%v/traffic/popular/referrers", owner, repo)
req, err := s.client.NewRequest("GET", u, nil)
@@ -61,7 +64,7 @@ func (s *RepositoriesService) ListTrafficReferrers(owner, repo string) ([]*Traff
}
var trafficReferrers []*TrafficReferrer
- resp, err := s.client.Do(req, &trafficReferrers)
+ resp, err := s.client.Do(ctx, req, &trafficReferrers)
if err != nil {
return nil, resp, err
}
@@ -72,7 +75,7 @@ func (s *RepositoriesService) ListTrafficReferrers(owner, repo string) ([]*Traff
// ListTrafficPaths list the top 10 popular content over the last 14 days.
//
// GitHub API docs: https://developer.github.com/v3/repos/traffic/#list-paths
-func (s *RepositoriesService) ListTrafficPaths(owner, repo string) ([]*TrafficPath, *Response, error) {
+func (s *RepositoriesService) ListTrafficPaths(ctx context.Context, owner, repo string) ([]*TrafficPath, *Response, error) {
u := fmt.Sprintf("repos/%v/%v/traffic/popular/paths", owner, repo)
req, err := s.client.NewRequest("GET", u, nil)
@@ -81,7 +84,7 @@ func (s *RepositoriesService) ListTrafficPaths(owner, repo string) ([]*TrafficPa
}
var paths []*TrafficPath
- resp, err := s.client.Do(req, &paths)
+ resp, err := s.client.Do(ctx, req, &paths)
if err != nil {
return nil, resp, err
}
@@ -92,7 +95,7 @@ func (s *RepositoriesService) ListTrafficPaths(owner, repo string) ([]*TrafficPa
// ListTrafficViews get total number of views for the last 14 days and breaks it down either per day or week.
//
// GitHub API docs: https://developer.github.com/v3/repos/traffic/#views
-func (s *RepositoriesService) ListTrafficViews(owner, repo string, opt *TrafficBreakdownOptions) (*TrafficViews, *Response, error) {
+func (s *RepositoriesService) ListTrafficViews(ctx context.Context, owner, repo string, opt *TrafficBreakdownOptions) (*TrafficViews, *Response, error) {
u := fmt.Sprintf("repos/%v/%v/traffic/views", owner, repo)
u, err := addOptions(u, opt)
if err != nil {
@@ -105,7 +108,7 @@ func (s *RepositoriesService) ListTrafficViews(owner, repo string, opt *TrafficB
}
trafficViews := new(TrafficViews)
- resp, err := s.client.Do(req, &trafficViews)
+ resp, err := s.client.Do(ctx, req, &trafficViews)
if err != nil {
return nil, resp, err
}
@@ -116,7 +119,7 @@ func (s *RepositoriesService) ListTrafficViews(owner, repo string, opt *TrafficB
// ListTrafficClones get total number of clones for the last 14 days and breaks it down either per day or week for the last 14 days.
//
// GitHub API docs: https://developer.github.com/v3/repos/traffic/#views
-func (s *RepositoriesService) ListTrafficClones(owner, repo string, opt *TrafficBreakdownOptions) (*TrafficClones, *Response, error) {
+func (s *RepositoriesService) ListTrafficClones(ctx context.Context, owner, repo string, opt *TrafficBreakdownOptions) (*TrafficClones, *Response, error) {
u := fmt.Sprintf("repos/%v/%v/traffic/clones", owner, repo)
u, err := addOptions(u, opt)
if err != nil {
@@ -129,7 +132,7 @@ func (s *RepositoriesService) ListTrafficClones(owner, repo string, opt *Traffic
}
trafficClones := new(TrafficClones)
- resp, err := s.client.Do(req, &trafficClones)
+ resp, err := s.client.Do(ctx, req, &trafficClones)
if err != nil {
return nil, resp, err
}