Documentation
¶
Index ¶
- Variables
- func NewResponseError(resp *sawyer.Response) (err error)
- type App
- type Asset
- type AuthMethod
- type Authorization
- type AuthorizationParams
- type AuthorizationsService
- type BasicAuth
- type Client
- func (c *Client) Authorizations(link *Hyperlink, m M) (auths *AuthorizationsService, err error)
- func (c *Client) Delete(url *url.URL, output interface{}) (result *Result)
- func (c *Client) Get(url *url.URL, output interface{}) (result *Result)
- func (c *Client) Head(url *url.URL, output interface{}) (result *Result)
- func (c *Client) Issues(link *Hyperlink, m M) (issues *IssuesService, err error)
- func (c *Client) NewRequest(urlStr string) (req *Request, err error)
- func (c *Client) Post(url *url.URL, input interface{}, output interface{}) (result *Result)
- func (c *Client) PullRequests(link *Hyperlink, m M) (pullRequests *PullRequestsService, err error)
- func (c *Client) Put(url *url.URL, input interface{}, output interface{}) (result *Result)
- func (c *Client) Releases(link *Hyperlink, m M) (releases *ReleasesService, err error)
- func (c *Client) Repositories(link *Hyperlink, m M) (repos *RepositoriesService, err error)
- func (c *Client) Root(link *Hyperlink) (root *RootService, err error)
- func (c *Client) Statuses(link *Hyperlink, m M) (statuses *StatusesService, err error)
- func (c *Client) Users(link *Hyperlink, m M) (users *UsersService, err error)
- type Commit
- type ErrorObject
- type Hyperlink
- type Issue
- type IssuesService
- type M
- type Organization
- type PullRequest
- type PullRequestForIssueParams
- type PullRequestParams
- type PullRequestsService
- type Release
- type ReleaseParams
- type ReleasesService
- type RepositoriesService
- type Repository
- type Request
- func (r *Request) Delete(output interface{}) (resp *Response, err error)
- func (r *Request) Get(output interface{}) (resp *Response, err error)
- func (r *Request) Head(output interface{}) (resp *Response, err error)
- func (r *Request) Post(input interface{}, output interface{}) (resp *Response, err error)
- func (r *Request) Put(input interface{}, output interface{}) (resp *Response, err error)
- type Response
- type ResponseError
- type ResponseErrorType
- type Result
- type Root
- type RootService
- type Status
- type StatusesService
- type TokenAuth
- type User
- type UsersService
Constants ¶
This section is empty.
Variables ¶
var ( RepositoryURL = Hyperlink("/repos/{owner}/{repo}") ForksURL = Hyperlink("/repos/{owner}/{repo}/forks") UserRepositoriesURL = Hyperlink("/user/repos") OrgRepositoriesURL = Hyperlink("/orgs/{org}/repos") )
var ( CurrentUserURL = Hyperlink("/user") UserURL = Hyperlink("/users{/user}{?since}") )
var (
AuthorizationsURL = Hyperlink("/authorizations{/auth_id}")
)
var (
PullRequestsURL = Hyperlink("/repos/{owner}/{repo}/pulls{/number}")
)
var (
ReleasesURL = Hyperlink("/repos/{owner}/{repo}/releases{/id}")
)
var (
RepoIssuesURL = Hyperlink("/repos/{owner}/{repo}/issues{/number}")
)
var (
RootURL = Hyperlink("/")
)
var (
StatusesURL = Hyperlink("/repos/{owner}/{repo}/statuses/{ref}")
)
Functions ¶
func NewResponseError ¶
Types ¶
type App ¶
type App struct {
*hypermedia.HALResource
ClientID string `json:"client_id,omitempty"`
URL string `json:"url,omitempty"`
Name string `json:"name,omitempty"`
}
type Asset ¶
type Asset struct {
ID int `json:"id,omitempty"`
Name string `json:"name,omitempty"`
Label string `json:"label,omitempty"`
ContentType string `json:"content_type,omitempty"`
State string `json:"state,omitempty"`
Size int `json:"size,omitempty"`
DownloadCount int `json:"download_count,omitempty"`
URL string `json:"url,omitempty"`
CreatedAt *time.Time `json:"created_at,omitempty"`
UpdatedAt *time.Time `json:"updated_at,omitempty"`
}
type AuthMethod ¶
type Authorization ¶
type Authorization struct {
*hypermedia.HALResource
ID int `json:"id,omitempty"`
URL string `json:"url,omitempty"`
App App `json:"app,omitempty"`
Token string `json:"token,omitempty"`
Note string `json:"note,omitempty"`
NoteURL string `json:"note_url,omitempty"`
Scopes []string `json:"scopes,omitempty"`
CreatedAt time.Time `json:"created_at,omitempty"`
UpdatedAt time.Time `json:"updated_at,omitempty"`
}
type AuthorizationParams ¶
type AuthorizationsService ¶
func (*AuthorizationsService) Create ¶
func (a *AuthorizationsService) Create(params interface{}) (auth *Authorization, result *Result)
func (*AuthorizationsService) Get ¶
func (a *AuthorizationsService) Get() (auth *Authorization, result *Result)
func (*AuthorizationsService) GetAll ¶
func (a *AuthorizationsService) GetAll() (auths []Authorization, result *Result)
type BasicAuth ¶
type Client ¶
type Client struct {
UserAgent string
AuthMethod AuthMethod
// contains filtered or unexported fields
}
func NewClient ¶
func NewClient(authMethod AuthMethod) *Client
func NewClientWith ¶
func NewClientWith(baseURL string, httpClient *http.Client, authMethod AuthMethod) *Client
func (*Client) Authorizations ¶
func (c *Client) Authorizations(link *Hyperlink, m M) (auths *AuthorizationsService, err error)
Create a AuthorizationsService with the base Hyperlink and the params M to expand the Hyperlink If no Hyperlink is passed in, it will use AuthorizationsURL.
func (*Client) Issues ¶
func (c *Client) Issues(link *Hyperlink, m M) (issues *IssuesService, err error)
Create a IssuesService with the base Hyperlink and the params M to expand the Hyperlink If no Hyperlink is passed in, it will use RepoIssuesURL.
func (*Client) PullRequests ¶
func (c *Client) PullRequests(link *Hyperlink, m M) (pullRequests *PullRequestsService, err error)
Create a PullRequestsService with the base Hyperlink and the params M to expand the Hyperlink If no Hyperlink is passed in, it will use PullRequestsHyperlink.
func (*Client) Releases ¶
func (c *Client) Releases(link *Hyperlink, m M) (releases *ReleasesService, err error)
Create a ReleasesService with the base Hyperlink and the params M to expand the Hyperlink If no Hyperlink is passed in, it will use ReleasesURL.
func (*Client) Repositories ¶
func (c *Client) Repositories(link *Hyperlink, m M) (repos *RepositoriesService, err error)
func (*Client) Root ¶
func (c *Client) Root(link *Hyperlink) (root *RootService, err error)
Create a RooService with the base Hyperlink If no Hyperlink is passed in, it will use RootHyperlink.
type Commit ¶
type Commit struct {
Label string `json:"label,omitempty"`
Ref string `json:"ref,omitempty"`
Sha string `json:"sha,omitempty"`
User User `json:"user,omitempty"`
Repo Repository `json:"repo,omitempty"`
}
type ErrorObject ¶
type ErrorObject struct {
Resource string `json:"resource,omitempty"`
Code string `json:"code,omitempty"`
Field string `json:"field,omitempty"`
Message string `json:"message,omitempty"`
}
func (*ErrorObject) Error ¶
func (e *ErrorObject) Error() string
type Issue ¶
type Issue struct {
*hypermedia.HALResource
URL string `json:"url,omitempty,omitempty"`
HTMLURL string `json:"html_url,omitempty,omitempty"`
Number int `json:"number,omitempty"`
State string `json:"state,omitempty"`
Title string `json:"title,omitempty"`
Body string `json:"body,omitempty"`
User User `json:"user,omitempty"`
Labels []struct {
URL string `json:"url,omitempty"`
Name string `json:"name,omitempty"`
Color string `json:"color,omitempty"`
}
Assignee User `json:"assignee,omitempty"`
Milestone struct {
URL string `json:"url,omitempty"`
Number int `json:"number,omitempty"`
State string `json:"state,omitempty"`
Title string `json:"title,omitempty"`
Description string `json:"description,omitempty"`
Creator User `json:"creator,omitempty"`
OpenIssues int `json:"open_issues,omitempty"`
ClosedIssues int `json:"closed_issues,omitempty"`
CreatedAt time.Time `json:"created_at,omitempty"`
DueOn *time.Time `json:"due_on,omitempty"`
}
Comments int `json:"comments,omitempty"`
PullRequest struct {
HTMLURL string `json:"html_url,omitempty"`
DiffURL string `json:"diff_url,omitempty"`
PatchURL string `json:"patch_url,omitempty"`
} `json:"pull_request,omitempty"`
CreatedAt time.Time `json:"created_at,omitempty"`
ClosedAt *time.Time `json:"closed_at,omitempty"`
UpdatedAt time.Time `json:"updated_at,omitempty"`
}
type IssuesService ¶
func (*IssuesService) Get ¶
func (i *IssuesService) Get() (issue *Issue, result *Result)
func (*IssuesService) GetAll ¶
func (i *IssuesService) GetAll() (issues []Issue, result *Result)
type Organization ¶
type Organization struct {
AvatarURL string `json:"avatar_url,omitempty"`
PublicMembersURL string `json:"public_member_url,omitempty"`
MembersURL string `json:"members_url,omitempty"`
EventsURL string `json:"events_url,omitempty"`
ReposURL string `json:"repos_url,omitempty"`
URL string `json:"url,omitempty"`
ID int `json:"id,omitempty"`
Login string `json:"login,omitempty"`
}
type PullRequest ¶
type PullRequest struct {
*hypermedia.HALResource
URL string `json:"url,omitempty"`
ID int `json:"id,omitempty"`
HTMLURL string `json:"html_url,omitempty"`
DiffURL string `json:"diff_url,omitempty"`
PatchURL string `json:"patch_url,omitempty"`
IssueURL string `json:"issue_url,omitempty"`
Number int `json:"number,omitempty"`
State string `json:"state,omitempty"`
Title string `json:"title,omitempty"`
User User `json:"user,omitempty"`
Body string `json:"body,omitempty"`
CreatedAt time.Time `json:"created_at,omitempty"`
UpdatedAt time.Time `json:"updated_at,omitempty"`
ClosedAt *time.Time `json:"closed_at,omitempty"`
MergedAt *time.Time `json:"merged_at,omitempty"`
MergeCommitSha string `json:"merge_commit_sha,omitempty"`
Assignee *User `json:"assignee,omitempty"`
CommitsURL string `json:"commits_url,omitempty"`
ReviewCommentsURL string `json:"review_comments_url,omitempty"`
ReviewCommentURL string `json:"review_comment_url,omitempty"`
CommentsURL string `json:"comments_url,omitempty"`
Head Commit `json:"head,omitempty"`
Base Commit `json:"base,omitempty"`
Merged bool `json:"merged,omitempty"`
MergedBy User `json:"merged_by,omitempty"`
Comments int `json:"comments,omitempty"`
ReviewComments int `json:"review_comments,omitempty"`
Commits int `json:"commits,omitempty"`
Additions int `json:"additions,omitempty"`
Deletions int `json:"deletions,omitempty"`
ChangedFiles int `json:"changed_files,omitempty"`
}
type PullRequestParams ¶
type PullRequestsService ¶
func (*PullRequestsService) Create ¶
func (p *PullRequestsService) Create(params interface{}) (pull *PullRequest, result *Result)
func (*PullRequestsService) Get ¶
func (p *PullRequestsService) Get() (pull *PullRequest, result *Result)
func (*PullRequestsService) GetAll ¶
func (p *PullRequestsService) GetAll() (pulls []PullRequest, result *Result)
type Release ¶
type Release struct {
*hypermedia.HALResource
ID int `json:"id,omitempty"`
URL string `json:"url,omitempty"`
HTMLURL string `json:"html_url,omitempty"`
AssetsURL string `json:"assets_url,omitempty"`
UploadURL string `json:"upload_url,omitempty"`
TagName string `json:"tag_name,omitempty"`
TargetCommitish string `json:"target_commitish,omitempty"`
Name string `json:"name,omitempty"`
Body string `json:"body,omitempty"`
Draft bool `json:"draft,omitempty"`
Prerelease bool `json:"prerelease,omitempty"`
CreatedAt *time.Time `json:"created_at,omitempty"`
PublishedAt *time.Time `json:"published_at,omitempty"`
Assets []Asset `json:"assets,omitempty"`
}
type ReleaseParams ¶
type ReleasesService ¶
func (*ReleasesService) Create ¶
func (r *ReleasesService) Create(params interface{}) (release *Release, result *Result)
func (*ReleasesService) GetAll ¶
func (r *ReleasesService) GetAll() (releases []Release, result *Result)
type RepositoriesService ¶
func (*RepositoriesService) Create ¶
func (r *RepositoriesService) Create(params interface{}) (repo *Repository, result *Result)
func (*RepositoriesService) Get ¶
func (r *RepositoriesService) Get() (repo *Repository, result *Result)
func (*RepositoriesService) GetAll ¶
func (r *RepositoriesService) GetAll() (repos []Repository, result *Result)
type Repository ¶
type Repository struct {
*hypermedia.HALResource
ID int `json:"id,omitempty"`
Owner User `json:"owner,omitempty"`
Name string `json:"name,omitempty"`
FullName string `json:"full_name,omitempty"`
Description string `json:"description,omitempty"`
Private bool `json:"private,omitempty"`
Fork bool `json:"fork,omitempty"`
URL string `json:"url,omitempty"`
HTMLURL string `json:"html_url,omitempty"`
CloneURL string `json:"clone_url,omitempty"`
GitURL string `json:"git_url,omitempty"`
SSHURL string `json:"ssh_url,omitempty"`
SVNURL string `json:"svn_url,omitempty"`
MirrorURL string `json:"mirror_url,omitempty"`
Homepage string `json:"homepage,omitempty"`
Language string `json:"language,omitempty"`
Forks int `json:"forks,omitempty"`
ForksCount int `json:"forks_count,omitempty"`
Watchers int `json:"watchers,omitempty"`
WatchersCount int `json:"watchers_count,omitempty"`
Size int `json:"size,omitempty"`
MasterBranch string `json:"master_branch,omitempty"`
OpenIssues int `json:"open_issues,omitempty"`
PushedAt time.Time `json:"pushed_at,omitempty"`
CreatedAt time.Time `json:"created_at,omitempty"`
UpdatedAt time.Time `json:"updated_at,omitempty"`
Organization *Organization `json:"organization,omitempty"`
Parent *Repository `json:"parent,omitempty"`
Source *Repository `json:"source,omitempty"`
HasIssues bool `json:"has_issues,omitempty"`
HasWiki bool `json:"has_wiki,omitempty"`
HasDownloads bool `json:"has_downloads,omitempty"`
}
type Request ¶
type Request struct {
// contains filtered or unexported fields
}
type Response ¶
type Response struct {
MediaType *mediatype.MediaType
MediaHeader *mediaheader.MediaHeader
*http.Response
}
type ResponseError ¶
type ResponseError struct {
Response *http.Response `json:"-"`
Type ResponseErrorType `json:"-"`
Message string `json:"message,omitempty"`
Err string `json:"error,omitempty"`
Errors []ErrorObject `json:"errors,omitempty"`
DocumentationURL string `json:"documentation_url,omitempty"`
}
func (*ResponseError) Error ¶
func (e *ResponseError) Error() string
type ResponseErrorType ¶
type ResponseErrorType int
const ( ErrorClientError ResponseErrorType = iota // 400-499 ErrorBadRequest ResponseErrorType = iota // 400 ErrorOneTimePasswordRequired ResponseErrorType = iota // 401 ErrorForbidden ResponseErrorType = iota // 403 ErrorTooManyRequests ResponseErrorType = iota // 403 ErrorTooManyLoginAttempts ResponseErrorType = iota // 403 ErrorNotFound ResponseErrorType = iota // 404 ErrorNotAcceptable ResponseErrorType = iota // 406 ErrorUnsupportedMediaType ResponseErrorType = iota // 414 ErrorUnprocessableEntity ResponseErrorType = iota // 422 ErrorServerError ResponseErrorType = iota // 500-599 ErrorInternalServerError ResponseErrorType = iota // 500 ErrorNotImplemented ResponseErrorType = iota // 501 ErrorBadGateway ResponseErrorType = iota // 502 ErrorMissingContentType ResponseErrorType = iota ErrorUnknownError ResponseErrorType = iota )
type Root ¶
type Root struct {
*hypermedia.HALResource
UserSearchURL Hyperlink `json:"user_search_url,omitempty"`
UserRepositoriesURL Hyperlink `json:"user_repositories_url,omitempty"`
UserOrganizationsURL Hyperlink `json:"user_organizations_url,omitempty"`
UserURL Hyperlink `json:"user_url,omitempty"`
TeamURL Hyperlink `json:"team_url,omitempty"`
StarredGistsURL Hyperlink `json:"starred_gists_url,omitempty"`
StarredURL Hyperlink `json:"starred_url,omitempty"`
CurrentUserRepositoriesURL Hyperlink `json:"current_user_repositories_url,omitempty"`
RepositorySearchURL Hyperlink `json:"repository_search_url,omitempty"`
RepositoryURL Hyperlink `json:"repository_url,omitempty"`
RateLimitURL Hyperlink `json:"rate_limit_url,omitempty"`
GistsURL Hyperlink `json:"gists_url,omitempty"`
FollowingURL Hyperlink `json:"following_url,omitempty"`
FeedsURL Hyperlink `json:"feeds_url,omitempty"`
EventsURL Hyperlink `json:"events_url,omitempty"`
EmojisURL Hyperlink `json:"emojis_url,omitempty"`
EmailsURL Hyperlink `json:"emails_url,omitempty"`
AuthorizationsURL Hyperlink `json:"authorizations_url,omitempty"`
CurrentUserURL Hyperlink `json:"current_user_url,omitempty"`
HubURL Hyperlink `json:"hub_url,omitempty"`
IssueSearchURL Hyperlink `json:"issue_search_url,omitempty"`
IssuesURL Hyperlink `json:"issues_url,omitempty"`
KeysURL Hyperlink `json:"keys_url,omitempty"`
NotificationsURL Hyperlink `json:"notifications_url,omitempty"`
OrganizationRepositoriesURL Hyperlink `json:"organization_repositories_url,omitempty"`
OrganizationURL Hyperlink `json:"organization_url,omitempty"`
PublicGistsURL Hyperlink `json:"public_gists_url,omitempty"`
PullsURL Hyperlink `json:"-"`
}
type RootService ¶
func (*RootService) Get ¶
func (r *RootService) Get() (root *Root, result *Result)
type Status ¶
type Status struct {
*hypermedia.HALResource
CreatedAt time.Time `json:"created_at,omitempty"`
UpdatedAt time.Time `json:"updated_at,omitempty"`
State string `json:"state,omitempty"`
TargetURL string `json:"target_url,omitempty"`
Description string `json:"description,omitempty"`
ID int `json:"id,omitempty"`
URL string `json:"url,omitempty"`
Creator User `json:"creator,omitempty"`
}
type StatusesService ¶
func (*StatusesService) GetAll ¶
func (s *StatusesService) GetAll() (statuses []Status, result *Result)
type User ¶
type User struct {
*hypermedia.HALResource
Login string `json:"login,omitempty"`
ID int `json:"id,omitempty"`
AvatarURL string `json:"avatar_url,omitempty"`
GravatarID string `json:"gravatar_id,omitempty"`
URL string `json:"url,omitempty"`
Name string `json:"name,omitempty"`
Company string `json:"company,omitempty"`
Blog string `json:"blog,omitempty"`
Location string `json:"location,omitempty"`
Email string `json:"email,omitempty"`
Hireable bool `json:"hireable,omitempty"`
Bio string `json:"bio,omitempty"`
PublicRepos int `json:"public_repos,omitempty"`
PublicGists int `json:"public_gists,omitempty"`
Followers int `json:"followers,omitempty"`
Following int `json:"following,omitempty"`
HTMLURL string `json:"html_url,omitempty"`
CreatedAt *time.Time `json:"created_at,omitempty"`
UpdatedAt *time.Time `json:"updated_at,omitempty"`
Type string `json:"type,omitempty"`
FollowingURL Hyperlink `json:"following_url,omitempty"`
FollowersURL Hyperlink `json:"followers_url,omitempty"`
GistsURL Hyperlink `json:"gists_url,omitempty"`
StarredURL Hyperlink `json:"starred_url,omitempty"`
SubscriptionsURL Hyperlink `json:"subscriptions_url,omitempty"`
OrganizationsURL Hyperlink `json:"organizations_url,omitempty"`
ReposURL Hyperlink `json:"repos_url,omitempty"`
EventsURL Hyperlink `json:"events_url,omitempty"`
ReceivedEventsURL Hyperlink `json:"received_events_url,omitempty"`
}
type UsersService ¶
A service to return user records
func (*UsersService) Get ¶
func (u *UsersService) Get() (user *User, result *Result)
Get a user based on UserService#URL
func (*UsersService) GetAll ¶
func (u *UsersService) GetAll() (users []User, result *Result)
Get a list of users based on UserService#URL
func (*UsersService) Update ¶
func (u *UsersService) Update(params interface{}) (user *User, result *Result)
Update a user based on UserService#URL