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(url *url.URL) (auths *AuthorizationsService)
- func (c *Client) Issues(url *url.URL) (issues *IssuesService)
- func (c *Client) NewRequest(urlStr string) (req *Request, err error)
- func (c *Client) PullRequests(url *url.URL) (pullRequests *PullRequestsService)
- func (c *Client) Rel(name string, m map[string]interface{}) (*url.URL, error)
- func (c *Client) Releases(url *url.URL) (releases *ReleasesService)
- func (c *Client) Repositories(url *url.URL) (repos *RepositoriesService)
- func (c *Client) Root(url *url.URL) (root *RootService)
- func (c *Client) Statuses(url *url.URL) (statuses *StatusesService)
- func (c *Client) Users(url *url.URL) (users *UsersService)
- type Commit
- type ErrorObject
- type Hyperlink
- type Issue
- type IssueParams
- type IssuesService
- type M
- type NetrcAuth
- 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) Patch(input interface{}, 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 ¶
View Source
var ( RepositoryURL = Hyperlink("repos/{owner}/{repo}") ForksURL = Hyperlink("repos/{owner}/{repo}/forks") UserRepositoriesURL = Hyperlink("user/repos") OrgRepositoriesURL = Hyperlink("orgs/{org}/repos") )
View Source
var ( CurrentUserURL = Hyperlink("user") UserURL = Hyperlink("users{/user}") )
View Source
var (
AuthorizationsURL = Hyperlink("authorizations{/id}")
)
View Source
var (
PullRequestsURL = Hyperlink("repos/{owner}/{repo}/pulls{/number}")
)
View Source
var (
ReleasesURL = Hyperlink("repos/{owner}/{repo}/releases{/id}")
)
View Source
var (
RepoIssuesURL = Hyperlink("repos/{owner}/{repo}/issues{/number}")
)
View Source
var (
RootURL = Hyperlink("")
)
View Source
var (
StatusesURL = Hyperlink("repos/{owner}/{repo}/statuses/{ref}")
)
Functions ¶
func NewResponseError ¶
func NewResponseError(resp *sawyer.Response) (err error)
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) All ¶
func (a *AuthorizationsService) All() (auths []Authorization, result *Result)
func (*AuthorizationsService) Create ¶
func (a *AuthorizationsService) Create(params interface{}) (auth *Authorization, result *Result)
func (*AuthorizationsService) One ¶
func (a *AuthorizationsService) One() (auth *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(url *url.URL) (auths *AuthorizationsService)
Create a AuthorizationsService with the base url.URL
func (*Client) Issues ¶
func (c *Client) Issues(url *url.URL) (issues *IssuesService)
Create a IssuesService with the base url.URL
func (*Client) PullRequests ¶
func (c *Client) PullRequests(url *url.URL) (pullRequests *PullRequestsService)
Create a PullRequestsService with the base url.URL
func (*Client) Releases ¶
func (c *Client) Releases(url *url.URL) (releases *ReleasesService)
Create a ReleasesService with the base url.URL
func (*Client) Repositories ¶
func (c *Client) Repositories(url *url.URL) (repos *RepositoriesService)
Create a RepositoriesService with the base url.URL
func (*Client) Root ¶
func (c *Client) Root(url *url.URL) (root *RootService)
Create a RooService with the base url.URL
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 IssueParams ¶ added in v1.0.0
type IssuesService ¶
func (*IssuesService) All ¶
func (i *IssuesService) All() (issues []Issue, result *Result)
func (*IssuesService) Create ¶ added in v1.0.0
func (i *IssuesService) Create(params interface{}) (issue *Issue, result *Result)
func (*IssuesService) One ¶
func (i *IssuesService) One() (issue *Issue, result *Result)
func (*IssuesService) Update ¶ added in v1.0.0
func (i *IssuesService) Update(params interface{}) (issue *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) All ¶
func (p *PullRequestsService) All() (pulls []PullRequest, result *Result)
func (*PullRequestsService) Create ¶
func (p *PullRequestsService) Create(params interface{}) (pull *PullRequest, result *Result)
func (*PullRequestsService) One ¶
func (p *PullRequestsService) One() (pull *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) All ¶
func (r *ReleasesService) All() (releases []Release, result *Result)
func (*ReleasesService) Create ¶
func (r *ReleasesService) Create(params interface{}) (release *Release, result *Result)
func (*ReleasesService) Update ¶ added in v1.0.0
func (r *ReleasesService) Update(params interface{}) (release *Release, result *Result)
type RepositoriesService ¶
func (*RepositoriesService) All ¶
func (r *RepositoriesService) All() (repos []Repository, result *Result)
func (*RepositoriesService) Create ¶
func (r *RepositoriesService) Create(params interface{}) (repo *Repository, result *Result)
func (*RepositoriesService) One ¶
func (r *RepositoriesService) One() (repo *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 hypermedia.Hyperlink `rel:"user_search" json:"user_search_url,omitempty"` UserRepositoriesURL hypermedia.Hyperlink `rel:"user_repositories" json:"user_repositories_url,omitempty"` UserOrganizationsURL hypermedia.Hyperlink `rel:"user_organizations" json:"user_organizations_url,omitempty"` UserURL hypermedia.Hyperlink `rel:"user" json:"user_url,omitempty"` TeamURL hypermedia.Hyperlink `rel:"team" json:"team_url,omitempty"` StarredGistsURL hypermedia.Hyperlink `rel:"starred_gists" json:"starred_gists_url,omitempty"` StarredURL hypermedia.Hyperlink `rel:"starred" json:"starred_url,omitempty"` CurrentUserRepositoriesURL hypermedia.Hyperlink `rel:"current_user_repositories" json:"current_user_repositories_url,omitempty"` RepositorySearchURL hypermedia.Hyperlink `rel:"repository_search" json:"repository_search_url,omitempty"` RepositoryURL hypermedia.Hyperlink `rel:"repository" json:"repository_url,omitempty"` RateLimitURL hypermedia.Hyperlink `rel:"rate_limit" json:"rate_limit_url,omitempty"` GistsURL hypermedia.Hyperlink `rel:"gists" json:"gists_url,omitempty"` FollowingURL hypermedia.Hyperlink `rel:"following" json:"following_url,omitempty"` FeedsURL hypermedia.Hyperlink `rel:"feeds" json:"feeds_url,omitempty"` EventsURL hypermedia.Hyperlink `rel:"events" json:"events_url,omitempty"` EmojisURL hypermedia.Hyperlink `rel:"emojis" json:"emojis_url,omitempty"` EmailsURL hypermedia.Hyperlink `rel:"emails" json:"emails_url,omitempty"` AuthorizationsURL hypermedia.Hyperlink `rel:"authorizations" json:"authorizations_url,omitempty"` CurrentUserURL hypermedia.Hyperlink `rel:"current_user" json:"current_user_url,omitempty"` HubURL hypermedia.Hyperlink `rel:"hub" json:"hub_url,omitempty"` IssueSearchURL hypermedia.Hyperlink `rel:"issue_search" json:"issue_search_url,omitempty"` IssuesURL hypermedia.Hyperlink `rel:"issues" json:"issues_url,omitempty"` KeysURL hypermedia.Hyperlink `rel:"keys" json:"keys_url,omitempty"` NotificationsURL hypermedia.Hyperlink `rel:"notifications" json:"notifications_url,omitempty"` OrganizationRepositoriesURL hypermedia.Hyperlink `rel:"organization_repositories" json:"organization_repositories_url,omitempty"` OrganizationURL hypermedia.Hyperlink `rel:"organization" json:"organization_url,omitempty"` PublicGistsURL hypermedia.Hyperlink `rel:"public_gists" json:"public_gists_url,omitempty"` PullsURL hypermedia.Hyperlink `rel:"pulls" json:"-"` // contains filtered or unexported fields }
func (*Root) Rels ¶
func (r *Root) Rels() hypermedia.Relations
type RootService ¶
func (*RootService) One ¶
func (r *RootService) One() (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) All ¶
func (s *StatusesService) All() (statuses []Status, result *Result)
type User ¶
type User struct { *hypermedia.HALResource SiteAdmin bool `json:"site_admin,omitempty"` 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"` 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) All ¶
func (u *UsersService) All() (users []User, result *Result)
Get a list of users based on UserService#URL
func (*UsersService) One ¶
func (u *UsersService) One() (user *User, result *Result)
Get a user based on UserService#URL
func (*UsersService) Update ¶
func (u *UsersService) Update(params interface{}) (user *User, result *Result)
Update a user based on UserService#URL
Click to show internal directories.
Click to hide internal directories.