github

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2022 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const REPOSITORY_NUMBER_PER_PAGE = 100

Variables

View Source
var Clients = []GithubClient{}
View Source
var Finalizers = make(chan func(), 16)

Functions

func CloneRepository

func CloneRepository(repoPath, url string) error

func OpenRepository

func OpenRepository(url string) error

func OpenUrl

func OpenUrl(url string) error

func RepositoryPath

func RepositoryPath(url string) string

func Run

func Run(ctx context.Context) error

func SearchCode

func SearchCode(ctx context.Context, input SearchInput) (searchResult, error)

func SearchRepositories

func SearchRepositories(ctx context.Context, input SearchInput) (searchResult, error)

func SendToChan added in v0.0.2

func SendToChan(data any, err error)

func SetAPIs

func SetAPIs(apis []API)

Types

type API

type API struct {
	Origin  string
	Address string
}

type CodeSearchResult

type CodeSearchResult struct {
	TotalCount int                    `json:"total_count"`
	Items      []CodeSearchResultItem `json:"items"`
}

type CodeSearchResultItem added in v0.0.6

type CodeSearchResultItem struct {
	Url        string     `json:"url"`
	Path       string     `json:"path"`
	HtmlUrl    string     `json:"html_url"`
	Repository Repository `json:"repository"`
}

func (CodeSearchResultItem) Origin added in v0.0.6

func (i CodeSearchResultItem) Origin() string

type ContentResult

type ContentResult struct {
	Url     string
	Content string
}

func FetchContent

func FetchContent(ctx context.Context, origin string, item CodeSearchResultItem) (ContentResult, error)

type Event

type Event struct {
	Event             string `json:"event"`
	RequestedReviewer User   `json:"requested_reviewer"`
}

type FooterMessage

type FooterMessage struct {
	Payload string
}

type GithubClient

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

func NewClient

func NewClient(origin, apiAddress string) (GithubClient, error)

func (*GithubClient) FetchAllRepostories

func (g *GithubClient) FetchAllRepostories(ctx context.Context, org string) ([]Repository, error)

func (*GithubClient) FetchEventsFromIssue

func (g *GithubClient) FetchEventsFromIssue(ctx context.Context, issue Issue) ([]Event, error)

func (*GithubClient) FetchReadMe

func (g *GithubClient) FetchReadMe(ctx context.Context, fullName string) (string, error)

func (*GithubClient) FetchSearchResultContents

func (g *GithubClient) FetchSearchResultContents(ctx context.Context, item CodeSearchResultItem) (string, error)

func (GithubClient) Request

func (g GithubClient) Request(ctx context.Context, method string, url string, paramMap map[string]any) ([]byte, error)

func (GithubClient) RequestWithEndpoint

func (g GithubClient) RequestWithEndpoint(ctx context.Context, method string, endpoint string, paramMap map[string]any) ([]byte, error)

func (*GithubClient) Search

func (g *GithubClient) Search(ctx context.Context, query string, page int, per_page int) (CodeSearchResult, error)

func (*GithubClient) SearchIssues

func (g *GithubClient) SearchIssues(ctx context.Context, query string, page int, per_page int) (IssueSearchResult, error)

func (*GithubClient) SearchRepositories

func (g *GithubClient) SearchRepositories(ctx context.Context, query string, page int, per_page int) (RepositoryItemsSearchResult, error)

type Issue

type Issue struct {
	Title     string `json:"title"`
	HtmlUrl   string `json:"html_url"`
	EventsUrl string `json:"events_url"`
	User      User   `json:"user"`
}

type IssueSearchResult

type IssueSearchResult struct {
	TotalCount int     `json:"total_count"`
	Items      []Issue `json:"items"`
}

type ReadMeResult

type ReadMeResult struct {
	HtmlUrl string
	ReadMe  string
}

func FetchReadMe

func FetchReadMe(ctx context.Context, origin string, repo Repository) (ReadMeResult, error)

type Repository

type Repository struct {
	FullName    string `json:"full_name"`
	HtmlUrl     string `json:"html_url"`
	Description string `json:"description"`
}

type RepositoryItemsSearchResult

type RepositoryItemsSearchResult struct {
	TotalCount int          `json:"total_count"`
	Items      []Repository `json:"items"`
}

type ResultItemWithOrigin added in v0.0.6

type ResultItemWithOrigin struct {
	ResultItem any
	Origin     string
}

type SearchInput

type SearchInput struct {
	Type      string
	Query     string
	CreatedAt time.Time
}

type SearchView added in v0.0.6

type SearchView struct {
	Type        string
	Result      searchResult
	IsSearching bool

	ContentMap        map[string]string
	ContentRequestMap map[string]bool
	// contains filtered or unexported fields
}

func NewCodeSearchView added in v0.0.2

func NewCodeSearchView() *SearchView

func NewRepoSearchView added in v0.0.2

func NewRepoSearchView() *SearchView

func (*SearchView) Body added in v0.0.6

func (m *SearchView) Body() *tui.View

func (*SearchView) HandleEvent added in v0.0.6

func (m *SearchView) HandleEvent(event any) any

func (*SearchView) SubView added in v0.0.6

func (m *SearchView) SubView() *tui.View

type User

type User struct {
	Login string `json:"login"`
}

Jump to

Keyboard shortcuts

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