{"modulePath":"github.com/Stackdome/stackdome","version":"v0.0.7-alpha","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package githubapp\n\nPackage githubapp is a thin GitHub App API client covering the manifest conversion, installation, and repository discovery flows. It wraps go-github for the REST calls and ghinstallation for the App-JWT / installation-token auth model, which differs from the rest of the git client (that uses a static token or basic auth).\n\nPackage githubapp is a generated GoMock package.\n\n## Constants\n\n```go\nconst (\n\tPermContents     = \"contents\"\n\tPermMetadata     = \"metadata\"\n\tPermPullRequests = \"pull_requests\"\n\tPermIssues       = \"issues\"\n\tPermLevelRead    = \"read\"\n\tPermLevelWrite   = \"write\"\n)\n```\nGitHub App permission scopes and access levels requested by the manifest.\n\n```go\nconst CloneUsername = \"x-access-token\"\n```\nCloneUsername is the username GitHub expects alongside an installation token for git-over-HTTPS operations.\n\n```go\nconst DefaultAPIBaseURL = \"https://api.github.com\"\n```\nDefaultAPIBaseURL is the public GitHub API endpoint.\n\n## Variables\n\n```go\nvar ErrCommentNotFound = errors.New(\"comment not found\")\n```\nErrCommentNotFound reports that the target comment no longer exists (e.g. a human deleted it); callers re-create instead of failing.\n\n## Types\n\n```go\ntype AppCredentials struct {\n\tAppID         int64  // numeric GitHub App ID\n\tSlug          string // URL slug, e.g. \"stackdome-ci\"\n\tPEM           string // RSA private key (PEM) used to sign app JWTs\n\tWebhookSecret string // secret for verifying webhook payload signatures\n\tClientID      string // OAuth client ID\n\tClientSecret  string // OAuth client secret\n}\n```\nAppCredentials are the app-level credentials produced by the manifest flow. Every field is a secret; the PEM in particular is the app's RSA private key used to sign app JWTs.\n\n```go\ntype AppHookAttributes struct {\n\tURL string `json:\"url\"`\n}\n```\nAppHookAttributes configures where GitHub delivers the app's webhooks.\n\n```go\ntype AppManifest struct {\n\tName               string            `json:\"name\"`\n\tURL                string            `json:\"url\"`\n\tRedirectURL        string            `json:\"redirect_url\"`\n\tSetupURL           string            `json:\"setup_url\"`\n\tPublic             bool              `json:\"public\"`\n\tHookAttributes     AppHookAttributes `json:\"hook_attributes\"`\n\tDefaultPermissions map[string]string `json:\"default_permissions\"`\n\tDefaultEvents      []string          `json:\"default_events\"`\n}\n```\nAppManifest is the GitHub App creation manifest the browser POSTs to github.com/settings/apps/new. GitHub has no SDK type for this input (go-github only converts the resulting code), so it is defined here alongside the other GitHub App wire types. The hub-specific URLs are filled in by the caller.\n\n```go\ntype Client interface {\n\t// ConvertManifestCode exchanges the temporary code from the manifest\n\t// redirect for the newly created app's credentials.\n\tConvertManifestCode(ctx context.Context, code string) (*AppCredentials, error)\n\t// ListInstallations lists every installation of the app (app JWT auth),\n\t// following pagination.\n\tListInstallations(ctx context.Context, creds *AppCredentials) ([]Installation, error)\n\t// GetInstallation fetches one installation of the app by its GitHub id.\n\tGetInstallation(ctx context.Context, creds *AppCredentials, installationID int64) (*Installation, error)\n\t// DeleteInstallation uninstalls the app from the installation's account.\n\tDeleteInstallation(ctx context.Context, creds *AppCredentials, installationID int64) error\n\t// MintInstallationToken creates a short-lived installation access token.\n\tMintInstallationToken(ctx context.Context, creds *AppCredentials, installationID int64) (*Token, error)\n\t// ListInstallationRepos lists one page of repositories the installation\n\t// can access.\n\tListInstallationRepos(ctx context.Context, creds *AppCredentials, installationID int64, page int) (*RepoPage, error)\n\t// GetRepo fetches repository details through the installation.\n\tGetRepo(ctx context.Context, creds *AppCredentials, installationID int64, owner, repo string) (*Repo, error)\n\t// ListBranches lists branch names through the installation.\n\tListBranches(ctx context.Context, creds *AppCredentials, installationID int64, owner, repo string) ([]string, error)\n}\n```\n\n```go\nfunc NewClient(spec ClientSpec) Client\n```\nNewClient returns a GitHub App client. Because credentials are supplied per call rather than stored, a single instance is safe to share across orgs and goroutines.\n\n```go\ntype ClientSpec struct {\n\t// BaseURL is optional; it defaults to the public GitHub API. Set it to a\n\t// GitHub Enterprise or test-server URL to point the client elsewhere.\n\tBaseURL string\n\t// HTTPClient is optional. Its Transport is used as the base round-tripper\n\t// beneath the app-JWT / installation-token auth transports, and its Timeout\n\t// (when set) overrides the 30s default.\n\tHTTPClient *http.Client\n}\n```\nClientSpec configures a Client.\n\n```go\ntype Installation struct {\n\tID                  int64\n\tAccountLogin        string // account (user or org) the app is installed on\n\tAccountType         string // \"User\" or \"Organization\"\n\tRepositorySelection string // \"all\" or \"selected\"\n\tSuspended           bool   // true when the installation is suspended and cannot be used\n}\n```\nInstallation is a GitHub App installation on a user or org account.\n\n```go\ntype MockPullRequestCommenter struct {\n\t// contains filtered or unexported fields\n}\n```\nMockPullRequestCommenter is a mock of PullRequestCommenter interface.\n\n```go\nfunc NewMockPullRequestCommenter(ctrl *gomock.Controller) *MockPullRequestCommenter\n```\nNewMockPullRequestCommenter creates a new mock instance.\n\n```go\nfunc (m *MockPullRequestCommenter) CreateComment(ctx context.Context, token, owner, repo string, prNumber int, body string) (int64, error)\n```\nCreateComment mocks base method.\n\n```go\nfunc (m *MockPullRequestCommenter) EXPECT() *MockPullRequestCommenterMockRecorder\n```\nEXPECT returns an object that allows the caller to indicate expected use.\n\n```go\nfunc (m *MockPullRequestCommenter) EditComment(ctx context.Context, token, owner, repo string, commentID int64, body string) error\n```\nEditComment mocks base method.\n\n```go\ntype MockPullRequestCommenterMockRecorder struct {\n\t// contains filtered or unexported fields\n}\n```\nMockPullRequestCommenterMockRecorder is the mock recorder for MockPullRequestCommenter.\n\n```go\nfunc (mr *MockPullRequestCommenterMockRecorder) CreateComment(ctx, token, owner, repo, prNumber, body any) *gomock.Call\n```\nCreateComment indicates an expected call of CreateComment.\n\n```go\nfunc (mr *MockPullRequestCommenterMockRecorder) EditComment(ctx, token, owner, repo, commentID, body any) *gomock.Call\n```\nEditComment indicates an expected call of EditComment.\n\n```go\ntype PullRequestCommenter interface {\n\tCreateComment(ctx context.Context, token, owner, repo string, prNumber int, body string) (int64, error)\n\tEditComment(ctx context.Context, token, owner, repo string, commentID int64, body string) error\n}\n```\nPullRequestCommenter posts and edits PR conversation comments using an installation token minted per call.\n\n```go\nfunc NewPullRequestCommenter(spec PullRequestCommenterSpec) PullRequestCommenter\n```\n\n```go\ntype PullRequestCommenterSpec struct {\n\t// BaseURL overrides the GitHub API base URL (tests); empty uses api.github.com.\n\tBaseURL string\n}\n```\n\n```go\ntype Repo struct {\n\tFullName      string // \"owner/name\"\n\tCloneURL      string // HTTPS clone URL\n\tDefaultBranch string\n\tPrivate       bool\n\tPushedAt      *time.Time // last push time; nil if never pushed\n\tOwnerLogin    string\n}\n```\nRepo is a repository visible to an installation.\n\n```go\ntype RepoPage struct {\n\tRepos      []Repo\n\tPage       int\n\tTotalCount int\n\tHasNext    bool\n}\n```\nRepoPage is one page of installation repositories. TotalCount is GitHub's unfiltered total for the installation, so when a query filter is applied len(Repos) may be smaller — even zero — while HasNext is still true.\n\n```go\ntype Token struct {\n\tValue     string\n\tExpiresAt time.Time\n}\n```\nToken is a minted installation access token. Installation tokens are short-lived (~1h), so ExpiresAt is what drives refresh scheduling.\n\n","path":"github.com/Stackdome/stackdome/pkg/clients/githubapp","name":"githubapp","synopsis":"Package githubapp is a thin GitHub App API client covering the manifest conversion, installation, and repository discovery flows.","isRedistributable":true}
