// Copyright 2016 The go-github AUTHORS. All rights reserved.//// Use of this source code is governed by a BSD-style// license that can be found in the LICENSE file.package githubimport ()// TrafficReferrer represent information about traffic from a referrer .typeTrafficReferrerstruct { Referrer *string`json:"referrer,omitempty"` Count *int`json:"count,omitempty"` Uniques *int`json:"uniques,omitempty"`}// TrafficPath represent information about the traffic on a path of the repo.typeTrafficPathstruct { Path *string`json:"path,omitempty"` Title *string`json:"title,omitempty"` Count *int`json:"count,omitempty"` Uniques *int`json:"uniques,omitempty"`}// TrafficData represent information about a specific timestamp in views or clones list.typeTrafficDatastruct { Timestamp *Timestamp`json:"timestamp,omitempty"` Count *int`json:"count,omitempty"` Uniques *int`json:"uniques,omitempty"`}// TrafficViews represent information about the number of views in the last 14 days.typeTrafficViewsstruct { Views []*TrafficData`json:"views,omitempty"` Count *int`json:"count,omitempty"` Uniques *int`json:"uniques,omitempty"`}// TrafficClones represent information about the number of clones in the last 14 days.typeTrafficClonesstruct { Clones []*TrafficData`json:"clones,omitempty"` Count *int`json:"count,omitempty"` Uniques *int`json:"uniques,omitempty"`}// TrafficBreakdownOptions specifies the parameters to methods that support breakdown per day or week.// Can be one of: day, week. Default: day.typeTrafficBreakdownOptionsstruct { Per string`url:"per,omitempty"`}// ListTrafficReferrers list the top 10 referrers over the last 14 days.//// GitHub API docs: https://docs.github.com/rest/metrics/traffic#get-top-referral-sources////meta:operation GET /repos/{owner}/{repo}/traffic/popular/referrersfunc ( *RepositoriesService) ( context.Context, , string) ([]*TrafficReferrer, *Response, error) { := fmt.Sprintf("repos/%v/%v/traffic/popular/referrers", , ) , := .client.NewRequest("GET", , nil)if != nil {returnnil, nil, }var []*TrafficReferrer , := .client.Do(, , &)if != nil {returnnil, , }return , , nil}// ListTrafficPaths list the top 10 popular content over the last 14 days.//// GitHub API docs: https://docs.github.com/rest/metrics/traffic#get-top-referral-paths////meta:operation GET /repos/{owner}/{repo}/traffic/popular/pathsfunc ( *RepositoriesService) ( context.Context, , string) ([]*TrafficPath, *Response, error) { := fmt.Sprintf("repos/%v/%v/traffic/popular/paths", , ) , := .client.NewRequest("GET", , nil)if != nil {returnnil, nil, }var []*TrafficPath , := .client.Do(, , &)if != nil {returnnil, , }return , , nil}// ListTrafficViews get total number of views for the last 14 days and breaks it down either per day or week.//// GitHub API docs: https://docs.github.com/rest/metrics/traffic#get-page-views////meta:operation GET /repos/{owner}/{repo}/traffic/viewsfunc ( *RepositoriesService) ( context.Context, , string, *TrafficBreakdownOptions) (*TrafficViews, *Response, error) { := fmt.Sprintf("repos/%v/%v/traffic/views", , ) , := addOptions(, )if != nil {returnnil, nil, } , := .client.NewRequest("GET", , nil)if != nil {returnnil, nil, } := new(TrafficViews) , := .client.Do(, , &)if != nil {returnnil, , }return , , nil}// 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://docs.github.com/rest/metrics/traffic#get-repository-clones////meta:operation GET /repos/{owner}/{repo}/traffic/clonesfunc ( *RepositoriesService) ( context.Context, , string, *TrafficBreakdownOptions) (*TrafficClones, *Response, error) { := fmt.Sprintf("repos/%v/%v/traffic/clones", , ) , := addOptions(, )if != nil {returnnil, nil, } , := .client.NewRequest("GET", , nil)if != nil {returnnil, nil, } := new(TrafficClones) , := .client.Do(, , &)if != nil {returnnil, , }return , , nil}
The pages are generated with Goldsv0.8.2. (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu.
PR and bug reports are welcome and can be submitted to the issue list.
Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds.