diff --git a/examples/markdown/main.go b/examples/markdown/main.go deleted file mode 100644 index ce4e8b1..0000000 --- a/examples/markdown/main.go +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2014 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) - - input := "# heading #\nLink to issue #1\n" - md, _, err := client.Markdown(input, &github.MarkdownOptions{Mode: "gfm", Context: "google/go-github"}) - if err != nil { - fmt.Printf("error: %v\n\n", err) - } - - fmt.Printf("converted markdown:\n%v\n", md) -} diff --git a/examples/repos/main.go b/examples/repos/main.go deleted file mode 100644 index b210c8d..0000000 --- a/examples/repos/main.go +++ /dev/null @@ -1,33 +0,0 @@ -// 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.RateLimits() - if err != nil { - fmt.Printf("Error fetching rate limit: %#v\n\n", err) - } else { - fmt.Printf("API Rate Limit: %#v\n\n", rate) - } -} diff --git a/github/misc_test.go b/github/misc_test.go index 8ca58d2..16c5512 100644 --- a/github/misc_test.go +++ b/github/misc_test.go @@ -46,6 +46,20 @@ func TestMarkdown(t *testing.T) { } } +func ExampleClient_Markdown() { + client := NewClient(nil) + + input := "# heading #\n\nLink to issue #1" + opt := &MarkdownOptions{Mode: "gfm", Context: "google/go-github"} + + output, _, err := client.Markdown(input, opt) + if err != nil { + fmt.Println(err) + } + + fmt.Println(output) +} + func TestListEmojis(t *testing.T) { setup() defer teardown() diff --git a/github/repos_test.go b/github/repos_test.go index 3265149..e875c0e 100644 --- a/github/repos_test.go +++ b/github/repos_test.go @@ -67,6 +67,20 @@ func TestRepositoriesService_List_invalidUser(t *testing.T) { testURLParseError(t, err) } +func ExampleRepositoriesService_List() { + client := NewClient(nil) + + user := "willnorris" + opt := &RepositoryListOptions{Type: "owner", Sort: "updated", Direction: "desc"} + + repos, _, err := client.Repositories.List(user, opt) + if err != nil { + fmt.Println(err) + } + + fmt.Printf("Recently updated repositories by %q: %v", user, Stringify(repos)) +} + func TestRepositoriesService_ListByOrg(t *testing.T) { setup() defer teardown()