forked from google/go-github
/
main.go
33 lines (26 loc) · 798 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// Copyright 2013 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 main
import (
"fmt"
"github.com/google/go-github/github"
)
func main() {
client := github.NewClient(nil)
fmt.Println("Recently updated repositories owned by user willnorris:")
opt := &github.RepositoryListOptions{Type: "owner", Sort: "updated", Direction: "desc"}
repos, _, err := client.Repositories.List("willnorris", opt)
if err != nil {
fmt.Printf("error: %v\n\n", err)
} else {
fmt.Printf("%v\n\n", github.Stringify(repos))
}
rate, _, err := client.RateLimit()
if err != nil {
fmt.Printf("Error fetching rate limit: %#v\n\n", err)
} else {
fmt.Printf("API Rate Limit: %#v\n\n", rate)
}
}