forked from alisteuber4ee1/API-Integration-Pagination
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
31 lines (26 loc) · 711 Bytes
/
Copy pathmain.go
File metadata and controls
31 lines (26 loc) · 711 Bytes
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
package main
import (
"context"
"fmt"
"log"
"os"
"time"
"github.com/alisteuber4ee1/API-Integration-Pagination/pkg/github"
google_github "github.com/google/go-github/v57/github"
)
func main() {
fmt.Println("Hello, Bounty Hunter!")
token := os.Getenv("GITHUB_TOKEN")
if token == "" {
fmt.Println("GITHUB_TOKEN not set, skipping demo run.")
return
}
client := google_github.NewClient(nil)
fetcher := github.NewIssueFetcher(client)
since := time.Now().Add(-7 * 24 * time.Hour)
issues, err := fetcher.FetchIssues(context.Background(), "google", "go-github", since, 10)
if err != nil {
log.Fatalf("Error: %v", err)
}
fmt.Printf("Fetched %d issues from google/go-github\n", len(issues))
}