MCPcopy Create free account
hub / github.com/ChappIO/git-backup / setDefaults

Method setDefaults

github.go:69–95  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

67}
68
69func (c *GithubConfig) setDefaults() {
70 if c.JobName == "" {
71 c.JobName = "GitHub"
72 }
73 if c.Collaborator == nil {
74 c.Collaborator = boolPointer(true)
75 }
76 if c.OrgMember == nil {
77 c.OrgMember = boolPointer(true)
78 }
79 if c.Owned == nil {
80 c.Owned = boolPointer(true)
81 }
82 if c.Starred == nil {
83 c.Starred = boolPointer(true)
84 }
85 httpClient := oauth2.NewClient(context.Background(), oauth2.StaticTokenSource(&oauth2.Token{AccessToken: c.AccessToken}))
86 if c.URL == "" {
87 c.client = github.NewClient(httpClient)
88 } else {
89 var err error
90 c.client, err = github.NewEnterpriseClient(fmt.Sprintf("%s/api/v3/", c.URL), fmt.Sprintf("%s/api/uploads/", c.URL), httpClient)
91 if err != nil {
92 panic(err)
93 }
94 }
95}
96
97func (c *GithubConfig) getMe() (*github.User, error) {
98 response, _, err := c.client.Users.Get(context.Background(), "")

Callers

nothing calls this directly

Calls 1

boolPointerFunction · 0.85

Tested by

no test coverage detected