Documentation
¶
Overview ¶
Package github provides a GitHub Contents API implementation of blog.Store for a specific owner and repository.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func NewClient ¶
func NewClient(opts ...ClientOption) (*Client, error)
NewClient creates a new Client to make requests to the Github API with a default HTTP client configured with OpenTelemetry instrumentation and a 10-second timeout. Can be configured with ClientOption functions.
type ClientOption ¶
ClientOption configures a Client during construction.
func WithToken ¶
func WithToken(token string) ClientOption
WithToken configures the GitHub token used to authenticate API requests. If set, the token is automatically sent in the Authorization header of each API request.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service retrieves Markdown articles through the GitHub Contents API using the provided HTTP client.
func NewService ¶
func NewService(client *Client, owner, repo string, opts ...ServiceOption) (*Service, error)
NewService creates a GitHub-backed article store for owner and repo.
func (*Service) GetArticleBySlug ¶
GetArticleBySlug returns the raw Markdown file named <slug>.md from the configured article directory.
type ServiceOption ¶
ServiceOption configures a Service during construction.
func WithArticlePath ¶
func WithArticlePath(articlePath string) ServiceOption
WithArticlePath configures the repository-relative directory containing article files. An empty path explicitly selects the repository root.