MCPcopy Index your code
hub / github.com/rilldata/rill / InstallationClient

Method InstallationClient

admin/github.go:116–143  ·  view source on GitHub ↗
(installationID int64, repoID *int64)

Source from the content-addressed store, hash-verified

114}
115
116func (g *githubClient) InstallationClient(installationID int64, repoID *int64) *github.Client {
117 g.cacheMu.Lock()
118 defer g.cacheMu.Unlock()
119
120 // lookup cache
121 cacheKey := installationCacheKey(installationID, repoID)
122 val, ok := g.installationCache.Get(cacheKey)
123 if ok {
124 return val.(*github.Client)
125 }
126
127 // create transport for the installation from the app transport
128 itr := ghinstallation.NewFromAppsTransport(g.appTransport, installationID)
129 if repoID != nil {
130 // set the repository ID in the transport options
131 opts := itr.InstallationTokenOptions
132 if opts == nil {
133 opts = &github.InstallationTokenOptions{}
134 }
135 opts.RepositoryIDs = []int64{*repoID}
136 }
137 // create the installation client
138 installationClient := github.NewClient(&http.Client{Transport: itr})
139
140 // add to cache
141 g.installationCache.Add(cacheKey, installationClient)
142 return installationClient
143}
144
145func (g *githubClient) InstallationToken(ctx context.Context, installationID, repoID int64) (string, time.Time, error) {
146 client := g.InstallationClient(installationID, &repoID)

Callers 5

InstallationTokenMethod · 0.95
DeleteBranchMethod · 0.95
CreateManagedRepoMethod · 0.95
DeleteManagedRepoMethod · 0.95

Calls 6

installationCacheKeyFunction · 0.85
NewClientMethod · 0.80
GetMethod · 0.65
AddMethod · 0.65
LockMethod · 0.45
UnlockMethod · 0.45

Tested by

no test coverage detected