Documentation
¶
Overview ¶
Package providerconn drives the onboarding steps that depend on an integration: checking whether an organization is connected to one, walking the user through a browser-based install, and resolving a repository's id.
Every function takes the integration as a provider.Provider, so supporting another one is a registry entry rather than a change here.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrTooManyRepositories = errors.New("too many repositories to search for a match")
ErrTooManyRepositories reports that the search hit its page cap before examining every repository, so the target may well be accessible. Callers must not report it as "the integration cannot access that repository" — the advice that follows from that, grant access and re-run, searches the same bounded prefix again.
Functions ¶
func EnsureConnected ¶
func EnsureConnected( ctx context.Context, client *apiclient.Client, p provider.Provider, orgID, returnURL string, noBrowser bool, ) (bool, error)
EnsureConnected reports whether the organization is connected to p, walking the user through a browser-based install when it is not. returnURL is where the provider returns the browser once the install completes.
Non-interactive sessions (or noBrowser) print the install URL and return false without waiting. Callers degrade to manual guidance on false or on an error.
func ResolveRepoID ¶
func ResolveRepoID( ctx context.Context, client *apiclient.Client, p provider.Provider, orgID, repoFullName string, ) (string, error)
ResolveRepoID returns p's ID for repoFullName ("owner/repo") among the repositories the organization's connection to p can reach. The endpoint offers no name filter, so the list has to be walked.
It returns "" with no error only when the whole list was examined and held no match; hitting the page cap first returns ErrTooManyRepositories.
Types ¶
This section is empty.