awesomego

package
v0.0.0-...-9e0aef4 Latest Latest
Warning

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

Go to latest
Published: May 1, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AwesomeGo

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

AwesomeGo is the main struct for the awesome-go-ranking package.

func NewAwesomeGo

func NewAwesomeGo(token string, client IGithubClient) *AwesomeGo

NewAwesomeGo creates a new AwesomeGo instance.

func (*AwesomeGo) FetchAndRankRepositories

func (ag *AwesomeGo) FetchAndRankRepositories(specificSection string, limit int) error

FetchAndRankRepositories fetches the repositories in the Awesome Go list

func (*AwesomeGo) Repositories

func (ag *AwesomeGo) Repositories() map[string][]Repository

Repositories returns the repositories in the Awesome Go list.

func (*AwesomeGo) Sections

func (ag *AwesomeGo) Sections() map[string]Section

Sections returns the sections in the Awesome Go list.

type GithubClient

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

GithubClient is a struct that represents a Github client.

func NewGithubClient

func NewGithubClient(token string) *GithubClient

NewGithubClient creates a new GithubClient instance.

func (*GithubClient) FetchReadmeMarkdown

func (ag *GithubClient) FetchReadmeMarkdown(ctx context.Context, owner, repo string) (string, error)

FetchReadmeMarkdown fetches the README.md file of a given repository.

func (*GithubClient) FetchRepository

func (gc *GithubClient) FetchRepository(ctx context.Context, owner, repo string) (*Repository, error)

FetchRepository fetches the repositories from the Github API

type GithubHtmlParserClient

type GithubHtmlParserClient struct {
}

GithubHtmlParserClient is a struct that represents a Github client.

func NewGithubHtmlParserClient

func NewGithubHtmlParserClient() *GithubHtmlParserClient

NewGithubHtmlParserClient creates a new GithubHtmlParserClient instance.

func (*GithubHtmlParserClient) FetchReadmeMarkdown

func (ghpc *GithubHtmlParserClient) FetchReadmeMarkdown(ctx context.Context, owner, repo string) (string, error)

FetchReadmeMarkdown fetches the README.md file of a given repository.

func (*GithubHtmlParserClient) FetchRepository

func (ghpc *GithubHtmlParserClient) FetchRepository(ctx context.Context, owner, repo string) (*Repository, error)

FetchRepository fetches the repositories from parsing the HTML page.

type IGithubClient

type IGithubClient interface {
	// FetchReadmeMarkdown fetches the README.md file of a given repository.
	FetchReadmeMarkdown(ctx context.Context, owner, repo string) (string, error)

	// FetchRepository fetches the repositories from the Github API
	FetchRepository(ctx context.Context, owner, repo string) (*Repository, error)
}

IGithubClient is an interface for the Github API

type MockGithubClient

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

MockGithubClient is a mock Github client

func NewMockGithubClient

func NewMockGithubClient(result *Repository, readme string) *MockGithubClient

NewMockGithubClient creates a new MockGithubClient instance

func (*MockGithubClient) FetchReadmeMarkdown

func (gc *MockGithubClient) FetchReadmeMarkdown(ctx context.Context, owner, repo string) (string, error)

FetchReadmeMarkdown fetches the README.md file of a given repository.

func (*MockGithubClient) FetchRepository

func (gc *MockGithubClient) FetchRepository(ctx context.Context, owner, repo string) (*Repository, error)

FetchRepository fetches the repositories from the Github API

type Repository

type Repository struct {
	Name        string
	URL         string
	Stars       int
	Forks       int
	LastUpdated time.Time
	Description string
}

Repository is a struct that represents a repository.

type Section

type Section struct {
	Name        string
	Description string
}

Section is a struct that represents a section in the Awesome Go list.

Jump to

Keyboard shortcuts

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