Documentation ¶
Index ¶
- func CheckResponse(r *http.Response) error
- func NewClient(httpClient *http.Client) *client
- func NewTokenClient(ctx context.Context, token string) *client
- type AcceptedError
- type Client
- type CodeResult
- type CodeSearchResult
- type CodeSearchService
- type ListOptions
- type RequestOption
- type SearchOptions
- type Timestamp
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckResponse ¶
func NewTokenClient ¶
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 ¶
func (s *CodeSearchService) Search(ctx context.Context, query string, opts *SearchOptions) (*CodeSearchResult, *http.Response, error)
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 SearchOptions ¶
type SearchOptions struct {
ListOptions
}
type Timestamp ¶
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) UnmarshalJSON ¶
UnmarshalJSON implements the json.Unmarshaler interface. Time is expected in RFC3339 or Unix format.
Click to show internal directories.
Click to hide internal directories.