forked from harness/gitness
-
Notifications
You must be signed in to change notification settings - Fork 0
/
github.go
36 lines (31 loc) · 780 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
package github
// New creates an instance of the Github Client
func New(token string) *Client {
c := &Client{}
c.Token = token
c.Keys = &KeyResource{c}
c.Repos = &RepoResource{c}
c.Users = &UserResource{c}
c.Orgs = &OrgResource{c}
c.Emails = &EmailResource{c}
c.Hooks = &HookResource{c}
c.Contents = &ContentResource{c}
c.RepoKeys = &RepoKeyResource{c}
c.ApiUrl = "https://api.github.com"
return c
}
type Client struct {
ApiUrl string
Token string
Repos *RepoResource
Users *UserResource
Orgs *OrgResource
Emails *EmailResource
Keys *KeyResource
Hooks *HookResource
Contents *ContentResource
RepoKeys *RepoKeyResource
}
// Guest Client that can be used to access
// public APIs that do not require authentication.
var Guest = New("")