github

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Token

func Token() string

Types

type Alert

type Alert struct {
	Number    int64     `json:"number"`
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
	HTMLURL   string    `json:"html_url"`
	Tool      struct {
		Name    string `json:"name"`
		Version string `json:"version"`
		GUID    string `json:"guid"`
	} `json:"tool"`
	Rule struct {
		ID, Name, Severity string
		Description        string   `json:"description"`
		SecuritySeverity   string   `json:"security_severity_level"`
		Tags               []string `json:"tags"`
	} `json:"rule"`
	Repository         Repository `json:"repository"`
	MostRecentInstance struct {
		Ref         string `json:"ref"`
		CommitSHA   string `json:"commit_sha"`
		AnalysisKey string `json:"analysis_key"`
		Environment string `json:"environment"`
		Category    string `json:"category"`
		Message     struct {
			Text string `json:"text"`
		} `json:"message"`
		Location struct {
			Path        string `json:"path"`
			StartLine   int    `json:"start_line"`
			EndLine     int    `json:"end_line"`
			StartColumn int    `json:"start_column"`
			EndColumn   int    `json:"end_column"`
		} `json:"location"`
	} `json:"most_recent_instance"`
}

type Client

type Client struct {
	HTTP           *http.Client
	BaseURL, Token string
	// OnPage reports only successfully decoded pages, with cumulative item counts.
	OnPage func(path string, pages, items int)
}

func New

func New() *Client

func (*Client) OrganizationAlerts

func (c *Client) OrganizationAlerts(ctx context.Context, org string) ([]Alert, error)

func (*Client) OrganizationRepositories

func (c *Client) OrganizationRepositories(ctx context.Context, org string) ([]Repository, error)

func (*Client) Repository

func (c *Client) Repository(ctx context.Context, owner, repo string) (Repository, error)

func (*Client) RepositoryAlerts

func (c *Client) RepositoryAlerts(ctx context.Context, owner, repo string) ([]Alert, error)

type Repository

type Repository struct {
	ID          int64   `json:"id"`
	Name        string  `json:"name"`
	FullName    string  `json:"full_name"`
	HTMLURL     string  `json:"html_url"`
	Description *string `json:"description"`
	Visibility  string  `json:"visibility"`
	Private     bool    `json:"private"`
	Archived    bool    `json:"archived"`
	Language    *string `json:"language"`
	Owner       struct {
		Login string `json:"login"`
	} `json:"owner"`
}

Jump to

Keyboard shortcuts

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