github

package
v0.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 29, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package github provides a client for interacting with the GitHub API, including fetching authenticated user information and contribution data.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIClient

type APIClient interface {
	Get(path string, response interface{}) error
	Post(path string, body io.Reader, response interface{}) error
}

APIClient interface defines the methods we need from the client

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client holds the API client

func NewClient

func NewClient(apiClient APIClient) *Client

NewClient creates a new GitHub client

func (*Client) FetchContributions

func (c *Client) FetchContributions(username string, year int) (*types.ContributionsResponse, error)

FetchContributions retrieves the contribution data for a given username and year from GitHub.

func (*Client) GetAuthenticatedUser

func (c *Client) GetAuthenticatedUser() (string, error)

GetAuthenticatedUser fetches the authenticated user's login name from GitHub.

func (*Client) GetUserJoinYear

func (c *Client) GetUserJoinYear(username string) (int, error)

GetUserJoinYear fetches the year a user joined GitHub using the GitHub API.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL