github

package
v0.0.0-...-f16dbe1 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2023 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckResponse

func CheckResponse(r *http.Response) error

func NewClient

func NewClient(httpClient *http.Client) *client

func NewTokenClient

func NewTokenClient(ctx context.Context, token string) *client

NewTokenClient returns a new GitHub API client authenticated with the provided token.

Types

type AcceptedError

type AcceptedError struct {
	// Raw contains the response body.
	Raw []byte
}

func (*AcceptedError) Error

func (*AcceptedError) Error() string

func (*AcceptedError) Is

func (ae *AcceptedError) Is(target error) bool

Is returns whether the provided error equals this error.

type Client

type Client interface {
	CodeSearch() *CodeSearchService
	Do(ctx context.Context, req *http.Request, v interface{}) (*http.Response, error)
	NewRequest(method, urlStr string, body interface{}, opts ...RequestOption) (*http.Request, error)
}

func NewTestClient

func NewTestClient() Client

type CodeResult

type CodeResult struct {
	Path      string `json:"path,omitempty"`
	Sha       string `json:"sha,omitempty"`
	RefName   string `json:"ref_name,omitempty"`
	Language  string `json:"language,omitempty"`
	RepoId    uint64 `json:"repo_id,omitempty"`
	CommitSha string `json:"commit_sha,omitempty"`
	RepoName  string `json:"repo_name,omitempty"`
}

type CodeSearchResult

type CodeSearchResult struct {
	Error                string        `json:"error,omitempty"`
	Failed               bool          `json:"failed,omitempty"`
	EpochId              int64         `json:"epoch_id,omitempty"`
	IndexVersion         int64         `json:"index_version,omitempty"`
	RequestId            string        `json:"request_id,omitempty"`
	ResultsCount         uint64        `json:"results_count,omitempty"`
	IsTreelightsAvail    bool          `json:"is_treelights_avail,omitempty"`
	SearchElapsedMs      uint64        `json:"search_elapsed_ms,omitempty"`
	PageToken            string        `json:"page_token,omitempty"`
	PageNumber           uint          `json:"page_number,omitempty"`
	TotalPages           uint          `json:"total_pages,omitempty"`
	ServingOffsetQueried uint64        `json:"serving_offset_queried,omitempty"`
	Results              []*CodeResult `json:"results,omitempty"`
}

type CodeSearchService

type CodeSearchService service

func (*CodeSearchService) Search

type ListOptions

type ListOptions struct {
	// For paginated result sets, page of results to retrieve.
	Page      int    `url:"p,omitempty"`
	PageToken string `url:"pageToken,omitempty"`
}

ListOptions specifies the optional parameters to various List methods that support offset pagination.

type RequestOption

type RequestOption func(req *http.Request)

type SearchOptions

type SearchOptions struct {
	ListOptions
}

type Timestamp

type Timestamp struct {
	time.Time
}

Timestamp represents a time that can be unmarshalled from a JSON string formatted as either an RFC3339 or Unix timestamp. This is necessary for some fields since the GitHub API is inconsistent in how it represents times. All exported methods of time.Time can be called on Timestamp.

func (Timestamp) Equal

func (t Timestamp) Equal(u Timestamp) bool

Equal reports whether t and u are equal based on time.Equal

func (Timestamp) String

func (t Timestamp) String() string

func (*Timestamp) UnmarshalJSON

func (t *Timestamp) UnmarshalJSON(data []byte) (err error)

UnmarshalJSON implements the json.Unmarshaler interface. Time is expected in RFC3339 or Unix format.

Jump to

Keyboard shortcuts

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