forked from torbiak/gopl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
github.go
43 lines (34 loc) · 880 Bytes
/
github.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
34
35
36
37
38
39
40
41
42
43
// Copyright © 2016 Alan A. A. Donovan & Brian W. Kernighan.
// License: https://creativecommons.org/licenses/by-nc-sa/4.0/
// See page 110.
//!+
// Package github provides a Go API for the GitHub issue tracker.
// See https://developer.github.com/v3/search/#search-issues.
package main
import (
"fmt"
"time"
)
const IssuesURL = "https://api.github.com/search/issues"
const APIURL = "https://api.github.com"
type IssuesSearchResult struct {
TotalCount int `json:"total_count"`
Items []*Issue
}
type Issue struct {
Number int
HTMLURL string `json:"html_url"`
Title string
State string
User *User
CreatedAt time.Time `json:"created_at"`
Body string // in Markdown format
}
func (i Issue) CacheURL() string {
return fmt.Sprintf("/issues/%d", i.Number)
}
type User struct {
Login string
HTMLURL string `json:"html_url"`
}
//!-