{"modulePath":"github.com/stacklok/releaseo","version":"v1.3.0","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package github\n\nPackage github provides utilities for interacting with the GitHub API.\n\n## Types\n\n```go\ntype Client struct {\n\t// contains filtered or unexported fields\n}\n```\nClient wraps the GitHub API client and implements PRCreator.\n\n```go\nfunc NewClient(ctx context.Context, token string, opts ...ClientOption) (*Client, error)\n```\nNewClient creates a new GitHub client with the provided token. Optional ClientOption functions can be provided to customize the client behavior.\n\n```go\nfunc (c *Client) CreateReleasePR(ctx context.Context, req PRRequest) (*PRResult, error)\n```\nCreateReleasePR creates a new branch with the modified files and opens a PR.\n\n```go\ntype ClientOption func(*Client)\n```\nClientOption is a functional option for configuring the Client.\n\n```go\nfunc WithFileReader(fr FileReader) ClientOption\n```\nWithFileReader sets a custom FileReader implementation for the Client. This is useful for testing or when file reading needs to be customized.\n\n```go\ntype FileReader interface {\n\t// ReadFile reads the contents of a file at the given path.\n\t// It returns the file contents as a byte slice, or an error if the read fails.\n\tReadFile(path string) ([]byte, error)\n}\n```\nFileReader defines the interface for reading file contents. This abstraction allows for dependency injection and makes the client testable by enabling mock file systems.\n\n```go\ntype PRCreator interface {\n\t// CreateReleasePR creates a new branch with the modified files and opens a PR.\n\tCreateReleasePR(ctx context.Context, req PRRequest) (*PRResult, error)\n}\n```\nPRCreator defines the interface for creating pull requests.\n\n```go\ntype PRRequest struct {\n\tOwner      string   // GitHub repository owner (required)\n\tRepo       string   // GitHub repository name (required)\n\tBaseBranch string   // Base branch for the PR (required, e.g., \"main\")\n\tHeadBranch string   // Feature branch to create (required)\n\tTitle      string   // PR title (required)\n\tBody       string   // PR body/description\n\tFiles      []string // Files to commit (required, must not be empty)\n}\n```\nPRRequest contains the parameters for creating a pull request. All fields except Body are required.\n\n```go\nfunc (r *PRRequest) Validate() error\n```\nValidate checks that all required fields are set.\n\n```go\ntype PRResult struct {\n\tNumber int\n\tURL    string\n}\n```\nPRResult contains the result of creating a pull request.\n\n","path":"github.com/stacklok/releaseo/internal/github","name":"github","synopsis":"Package github provides utilities for interacting with the GitHub API.","isRedistributable":true}
