Documentation ¶
Index ¶
- Constants
- Variables
- func BasicAuthEncode(user, pass string) string
- func Bool(v bool) *bool
- func Int64(v int64) *int64
- func String(v string) *string
- func Version() string
- type AccessToken
- type AddCollaboratorOption
- type AddOrgMembershipOption
- type Branch
- type ChangesFromPayload
- type ChangesPayload
- type Client
- func (c *Client) AddCollaborator(user, repo, collaborator string, opt AddCollaboratorOption) error
- func (c *Client) AddEmail(opt CreateEmailOption) ([]*Email, error)
- func (c *Client) AddIssueLabels(owner, repo string, index int64, opt IssueLabelsOption) ([]*Label, error)
- func (c *Client) AddOrgMembership(org, user string, opt AddOrgMembershipOption) error
- func (c *Client) AdminAddTeamMembership(teamID int64, user string) error
- func (c *Client) AdminAddTeamRepository(teamID int64, repo string) error
- func (c *Client) AdminCreateOrg(user string, opt CreateOrgOption) (*Organization, error)
- func (c *Client) AdminCreateRepo(user string, opt CreateRepoOption) (*Repository, error)
- func (c *Client) AdminCreateTeam(user string, opt CreateTeamOption) (*Team, error)
- func (c *Client) AdminCreateUser(opt CreateUserOption) (*User, error)
- func (c *Client) AdminCreateUserPublicKey(user string, opt CreateKeyOption) (*PublicKey, error)
- func (c *Client) AdminDeleteUser(user string) error
- func (c *Client) AdminEditUser(user string, opt EditUserOption) error
- func (c *Client) ClearIssueLabels(owner, repo string, index int64) error
- func (c *Client) CreateAccessToken(user, pass string, opt CreateAccessTokenOption) (*AccessToken, error)
- func (c *Client) CreateDeployKey(user, repo string, opt CreateKeyOption) (*DeployKey, error)
- func (c *Client) CreateIssue(owner, repo string, opt CreateIssueOption) (*Issue, error)
- func (c *Client) CreateIssueComment(owner, repo string, index int64, opt CreateIssueCommentOption) (*Comment, error)
- func (c *Client) CreateLabel(owner, repo string, opt CreateLabelOption) (*Label, error)
- func (c *Client) CreateMilestone(owner, repo string, opt CreateMilestoneOption) (*Milestone, error)
- func (c *Client) CreateOrg(opt CreateOrgOption) (*Organization, error)
- func (c *Client) CreateOrgRepo(org string, opt CreateRepoOption) (*Repository, error)
- func (c *Client) CreatePublicKey(opt CreateKeyOption) (*PublicKey, error)
- func (c *Client) CreateRepo(opt CreateRepoOption) (*Repository, error)
- func (c *Client) CreateRepoHook(user, repo string, opt CreateHookOption) (*Hook, error)
- func (c *Client) DeleteCollaborator(user, repo, collaborator string) error
- func (c *Client) DeleteDeployKey(owner, repo string, keyID int64) error
- func (c *Client) DeleteEmail(opt CreateEmailOption) error
- func (c *Client) DeleteIssueComment(owner, repo string, index, commentID int64) error
- func (c *Client) DeleteIssueLabel(owner, repo string, index, label int64) error
- func (c *Client) DeleteLabel(owner, repo string, id int64) error
- func (c *Client) DeleteMilestone(owner, repo string, id int64) error
- func (c *Client) DeletePublicKey(keyID int64) error
- func (c *Client) DeleteRepo(owner, repo string) error
- func (c *Client) DeleteRepoHook(user, repo string, id int64) error
- func (c *Client) EditIssue(owner, repo string, index int64, opt EditIssueOption) (*Issue, error)
- func (c *Client) EditIssueComment(owner, repo string, index, commentID int64, opt EditIssueCommentOption) (*Comment, error)
- func (c *Client) EditIssueTracker(owner, repo string, opt EditIssueTrackerOption) error
- func (c *Client) EditLabel(owner, repo string, id int64, opt EditLabelOption) (*Label, error)
- func (c *Client) EditMilestone(owner, repo string, id int64, opt EditMilestoneOption) (*Milestone, error)
- func (c *Client) EditOrg(orgname string, opt EditOrgOption) error
- func (c *Client) EditRepoHook(user, repo string, id int64, opt EditHookOption) error
- func (c *Client) EditWiki(owner, repo string, opt EditWikiOption) error
- func (c *Client) Follow(target string) error
- func (c *Client) GetArchive(user, repo, ref, format string) ([]byte, error)
- func (c *Client) GetDeployKey(user, repo string, keyID int64) (*DeployKey, error)
- func (c *Client) GetFile(user, repo, ref, tree string) ([]byte, error)
- func (c *Client) GetIssue(owner, repo string, index int64) (*Issue, error)
- func (c *Client) GetIssueLabels(owner, repo string, index int64) ([]*Label, error)
- func (c *Client) GetMilestone(owner, repo string, id int64) (*Milestone, error)
- func (c *Client) GetOrg(orgname string) (*Organization, error)
- func (c *Client) GetPublicKey(keyID int64) (*PublicKey, error)
- func (c *Client) GetReferenceSHA(user, repo, ref string) (string, error)
- func (c *Client) GetRepo(owner, reponame string) (*Repository, error)
- func (c *Client) GetRepoBranch(user, repo, branch string) (*Branch, error)
- func (c *Client) GetRepoLabel(owner, repo string, id int64) (*Label, error)
- func (c *Client) GetSelfInfo() (*User, error)
- func (c *Client) GetSingleCommit(user, repo, commitID string) (*Commit, error)
- func (c *Client) GetUserInfo(user string) (*User, error)
- func (c *Client) IsCollaborator(user, repo, collaborator string) error
- func (c *Client) IsFollowing(target string) bool
- func (c *Client) IsUserFollowing(user, target string) bool
- func (c *Client) ListAccessTokens(user, pass string) ([]*AccessToken, error)
- func (c *Client) ListCollaborator(user, repo string) ([]*Collaborator, error)
- func (c *Client) ListDeployKeys(user, repo string) ([]*DeployKey, error)
- func (c *Client) ListEmails() ([]*Email, error)
- func (c *Client) ListFollowers(user string, page int) ([]*User, error)
- func (c *Client) ListFollowing(user string, page int) ([]*User, error)
- func (c *Client) ListIssueComments(owner, repo string, index int64) ([]*Comment, error)
- func (c *Client) ListIssues(opt ListIssueOption) ([]*Issue, error)
- func (c *Client) ListMyFollowers(page int) ([]*User, error)
- func (c *Client) ListMyFollowing(page int) ([]*User, error)
- func (c *Client) ListMyOrgs() ([]*Organization, error)
- func (c *Client) ListMyPublicKeys() ([]*PublicKey, error)
- func (c *Client) ListMyRepos() ([]*Repository, error)
- func (c *Client) ListOrgRepos(org string) ([]*Repository, error)
- func (c *Client) ListPublicKeys(user string) ([]*PublicKey, error)
- func (c *Client) ListRepoBranches(user, repo string) ([]*Branch, error)
- func (c *Client) ListRepoHooks(user, repo string) ([]*Hook, error)
- func (c *Client) ListRepoIssueComments(owner, repo string) ([]*Comment, error)
- func (c *Client) ListRepoIssues(owner, repo string, opt ListIssueOption) ([]*Issue, error)
- func (c *Client) ListRepoLabels(owner, repo string) ([]*Label, error)
- func (c *Client) ListRepoMilestones(owner, repo string) ([]*Milestone, error)
- func (c *Client) ListTeams(name string) ([]*Team, error)
- func (c *Client) ListUserIssues(opt ListIssueOption) ([]*Issue, error)
- func (c *Client) ListUserOrgs(user string) ([]*Organization, error)
- func (c *Client) ListUserRepos(user string) ([]*Repository, error)
- func (c *Client) MigrateRepo(opt MigrateRepoOption) (*Repository, error)
- func (c *Client) MirrorSync(owner, repo string) error
- func (c *Client) ReplaceIssueLabels(owner, repo string, index int64, opt IssueLabelsOption) ([]*Label, error)
- func (c *Client) SetHTTPClient(client *http.Client)
- func (c *Client) Unfollow(target string) error
- type Collaborator
- type Comment
- type Commit
- type CommitMeta
- type CommitUser
- type CreateAccessTokenOption
- type CreateEmailOption
- type CreateHookOption
- type CreateIssueCommentOption
- type CreateIssueOption
- type CreateKeyOption
- type CreateLabelOption
- type CreateMilestoneOption
- type CreateOrgOption
- type CreatePayload
- type CreateRepoOption
- type CreateTeamOption
- type CreateUserOption
- type DeletePayload
- type DeployKey
- type EditHookOption
- type EditIssueCommentOption
- type EditIssueOption
- type EditIssueTrackerOption
- type EditLabelOption
- type EditMilestoneOption
- type EditOrgOption
- type EditUserOption
- type EditWikiOption
- type Email
- type ForkPayload
- type Hook
- type HookIssueAction
- type HookIssueCommentAction
- type HookReleaseAction
- type Issue
- type IssueCommentPayload
- type IssueLabelsOption
- type IssuesPayload
- type Label
- type ListIssueOption
- type MarkdownOption
- type MigrateRepoOption
- type Milestone
- type Organization
- type PayloadCommit
- type PayloadUser
- type Payloader
- type Permission
- type PublicKey
- type PullRequest
- type PullRequestMeta
- type PullRequestPayload
- type PushPayload
- type PusherType
- type Release
- type ReleasePayload
- type RepoCommit
- type Repository
- type StateType
- type Team
- type User
Constants ¶
const (
MediaApplicationSHA = "application/vnd.gogs.sha"
)
Variables ¶
var (
ErrInvalidReceiveHook = errors.New("invalid JSON payload received over webhook")
)
Functions ¶
func BasicAuthEncode ¶
Types ¶
type AccessToken ¶
AccessToken represents a API access token.
type AddCollaboratorOption ¶
type AddCollaboratorOption struct {
Permission *string `json:"permission"`
}
type AddOrgMembershipOption ¶
type AddOrgMembershipOption struct {
Role string `json:"role" binding:"Required"`
}
type Branch ¶
type Branch struct { Name string `json:"name"` Commit *PayloadCommit `json:"commit"` }
Branch represents a repository branch.
type ChangesFromPayload ¶
type ChangesFromPayload struct {
From string `json:"from"`
}
type ChangesPayload ¶
type ChangesPayload struct { Title *ChangesFromPayload `json:"title,omitempty"` Body *ChangesFromPayload `json:"body,omitempty"` }
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client represents a Gogs API client.
func (*Client) AddCollaborator ¶
func (c *Client) AddCollaborator(user, repo, collaborator string, opt AddCollaboratorOption) error
func (*Client) AddIssueLabels ¶
func (*Client) AddOrgMembership ¶
func (c *Client) AddOrgMembership(org, user string, opt AddOrgMembershipOption) error
func (*Client) AdminAddTeamMembership ¶
func (*Client) AdminAddTeamRepository ¶
func (*Client) AdminCreateOrg ¶
func (c *Client) AdminCreateOrg(user string, opt CreateOrgOption) (*Organization, error)
func (*Client) AdminCreateRepo ¶
func (c *Client) AdminCreateRepo(user string, opt CreateRepoOption) (*Repository, error)
func (*Client) AdminCreateTeam ¶
func (c *Client) AdminCreateTeam(user string, opt CreateTeamOption) (*Team, error)
func (*Client) AdminCreateUser ¶
func (c *Client) AdminCreateUser(opt CreateUserOption) (*User, error)
func (*Client) AdminCreateUserPublicKey ¶
func (c *Client) AdminCreateUserPublicKey(user string, opt CreateKeyOption) (*PublicKey, error)
func (*Client) AdminDeleteUser ¶
func (*Client) AdminEditUser ¶
func (c *Client) AdminEditUser(user string, opt EditUserOption) error
func (*Client) ClearIssueLabels ¶
func (*Client) CreateAccessToken ¶
func (c *Client) CreateAccessToken(user, pass string, opt CreateAccessTokenOption) (*AccessToken, error)
func (*Client) CreateDeployKey ¶
func (c *Client) CreateDeployKey(user, repo string, opt CreateKeyOption) (*DeployKey, error)
func (*Client) CreateIssue ¶
func (c *Client) CreateIssue(owner, repo string, opt CreateIssueOption) (*Issue, error)
func (*Client) CreateIssueComment ¶
func (c *Client) CreateIssueComment(owner, repo string, index int64, opt CreateIssueCommentOption) (*Comment, error)
CreateIssueComment create comment on an issue.
func (*Client) CreateLabel ¶
func (c *Client) CreateLabel(owner, repo string, opt CreateLabelOption) (*Label, error)
func (*Client) CreateMilestone ¶
func (c *Client) CreateMilestone(owner, repo string, opt CreateMilestoneOption) (*Milestone, error)
func (*Client) CreateOrg ¶
func (c *Client) CreateOrg(opt CreateOrgOption) (*Organization, error)
func (*Client) CreateOrgRepo ¶
func (c *Client) CreateOrgRepo(org string, opt CreateRepoOption) (*Repository, error)
CreateOrgRepo creates an organization repository for authenticated user.
func (*Client) CreatePublicKey ¶
func (c *Client) CreatePublicKey(opt CreateKeyOption) (*PublicKey, error)
func (*Client) CreateRepo ¶
func (c *Client) CreateRepo(opt CreateRepoOption) (*Repository, error)
CreateRepo creates a repository for authenticated user.
func (*Client) CreateRepoHook ¶
func (c *Client) CreateRepoHook(user, repo string, opt CreateHookOption) (*Hook, error)
func (*Client) DeleteCollaborator ¶
func (*Client) DeleteDeployKey ¶
func (*Client) DeleteEmail ¶
func (c *Client) DeleteEmail(opt CreateEmailOption) error
func (*Client) DeleteIssueComment ¶
DeleteIssueComment deletes an issue comment.
func (*Client) DeleteIssueLabel ¶
func (*Client) DeleteMilestone ¶
func (*Client) DeletePublicKey ¶
func (*Client) DeleteRepo ¶
DeleteRepo deletes a repository of user or organization.
func (*Client) EditIssueComment ¶
func (c *Client) EditIssueComment(owner, repo string, index, commentID int64, opt EditIssueCommentOption) (*Comment, error)
EditIssueComment edits an issue comment.
func (*Client) EditIssueTracker ¶
func (c *Client) EditIssueTracker(owner, repo string, opt EditIssueTrackerOption) error
EditIssueTracker updates issue tracker options of the repository.
func (*Client) EditMilestone ¶
func (*Client) EditRepoHook ¶
func (c *Client) EditRepoHook(user, repo string, id int64, opt EditHookOption) error
func (*Client) EditWiki ¶
func (c *Client) EditWiki(owner, repo string, opt EditWikiOption) error
EditWiki updates wiki options of the repository.
func (*Client) GetArchive ¶
GetArchive downloads the full contents of a repository. Ref can be a branch/tag/commit.
func (*Client) GetDeployKey ¶
func (*Client) GetFile ¶
GetFile downloads a file of repository, ref can be branch/tag/commit. e.g.: ref -> master, tree -> macaron.go(no leading slash)
func (*Client) GetIssueLabels ¶
func (*Client) GetMilestone ¶
func (*Client) GetReferenceSHA ¶
func (*Client) GetRepo ¶
func (c *Client) GetRepo(owner, reponame string) (*Repository, error)
GetRepo returns information of a repository of given owner.
func (*Client) GetRepoBranch ¶
func (*Client) GetRepoLabel ¶
func (*Client) GetSelfInfo ¶
func (*Client) GetSingleCommit ¶
func (*Client) IsCollaborator ¶
func (*Client) IsFollowing ¶
func (*Client) IsUserFollowing ¶
func (*Client) ListAccessTokens ¶
func (c *Client) ListAccessTokens(user, pass string) ([]*AccessToken, error)
func (*Client) ListCollaborator ¶
func (c *Client) ListCollaborator(user, repo string) ([]*Collaborator, error)
func (*Client) ListDeployKeys ¶
func (*Client) ListEmails ¶
func (*Client) ListFollowers ¶
func (*Client) ListFollowing ¶
func (*Client) ListIssueComments ¶
ListIssueComments list comments on an issue.
func (*Client) ListIssues ¶
func (c *Client) ListIssues(opt ListIssueOption) ([]*Issue, error)
func (*Client) ListMyOrgs ¶
func (c *Client) ListMyOrgs() ([]*Organization, error)
func (*Client) ListMyPublicKeys ¶
func (*Client) ListMyRepos ¶
func (c *Client) ListMyRepos() ([]*Repository, error)
ListMyRepos lists all repositories for the authenticated user that has access to.
func (*Client) ListOrgRepos ¶
func (c *Client) ListOrgRepos(org string) ([]*Repository, error)
func (*Client) ListRepoBranches ¶
func (*Client) ListRepoIssueComments ¶
ListRepoIssueComments list comments for a given repo.
func (*Client) ListRepoIssues ¶
func (c *Client) ListRepoIssues(owner, repo string, opt ListIssueOption) ([]*Issue, error)
func (*Client) ListRepoLabels ¶
func (*Client) ListRepoMilestones ¶
func (*Client) ListUserIssues ¶
func (c *Client) ListUserIssues(opt ListIssueOption) ([]*Issue, error)
func (*Client) ListUserOrgs ¶
func (c *Client) ListUserOrgs(user string) ([]*Organization, error)
func (*Client) ListUserRepos ¶
func (c *Client) ListUserRepos(user string) ([]*Repository, error)
func (*Client) MigrateRepo ¶
func (c *Client) MigrateRepo(opt MigrateRepoOption) (*Repository, error)
MigrateRepo migrates a repository from other Git hosting sources for the authenticated user.
To migrate a repository for a organization, the authenticated user must be a owner of the specified organization.
func (*Client) MirrorSync ¶
func (*Client) ReplaceIssueLabels ¶
func (*Client) SetHTTPClient ¶
SetHTTPClient replaces default http.Client with user given one.
type Collaborator ¶
type Collaborator struct { *User Permissions Permission `json:"permissions"` }
type Comment ¶
type Comment struct { ID int64 `json:"id"` HTMLURL string `json:"html_url"` Poster *User `json:"user"` Body string `json:"body"` Created time.Time `json:"created_at"` Updated time.Time `json:"updated_at"` }
Comment represents a comment in commit and issue page.
type Commit ¶
type Commit struct { *CommitMeta HTMLURL string `json:"html_url"` RepoCommit *RepoCommit `json:"commit"` Author *User `json:"author"` Committer *User `json:"committer"` Parents []*CommitMeta `json:"parents"` }
Commit contains information generated from a Git commit.
type CommitMeta ¶
CommitMeta contains meta information of a commit in terms of API.
type CommitUser ¶
type CommitUser struct { Name string `json:"name"` Email string `json:"email"` Date string `json:"date"` }
CommitUser contains information of a user in the context of a commit.
type CreateAccessTokenOption ¶
type CreateAccessTokenOption struct {
Name string `json:"name" binding:"Required"`
}
type CreateEmailOption ¶
type CreateEmailOption struct {
Emails []string `json:"emails"`
}
type CreateHookOption ¶
type CreateIssueCommentOption ¶
type CreateIssueCommentOption struct {
Body string `json:"body" binding:"Required"`
}
CreateIssueCommentOption is option when creating an issue comment.
type CreateIssueOption ¶
type CreateKeyOption ¶
type CreateLabelOption ¶
type CreateMilestoneOption ¶
type CreateOrgOption ¶
type CreatePayload ¶
type CreatePayload struct { Ref string `json:"ref"` RefType string `json:"ref_type"` Sha string `json:"sha"` DefaultBranch string `json:"default_branch"` Repo *Repository `json:"repository"` Sender *User `json:"sender"` }
func ParseCreateHook ¶
func ParseCreateHook(raw []byte) (*CreatePayload, error)
ParseCreateHook parses create event hook content.
func (*CreatePayload) JSONPayload ¶
func (p *CreatePayload) JSONPayload() ([]byte, error)
type CreateRepoOption ¶
type CreateRepoOption struct { Name string `json:"name" binding:"Required;AlphaDashDot;MaxSize(100)"` Description string `json:"description" binding:"MaxSize(255)"` Private bool `json:"private"` Unlisted bool `json:"unlisted"` AutoInit bool `json:"auto_init"` Gitignores string `json:"gitignores"` License string `json:"license"` Readme string `json:"readme"` }
type CreateTeamOption ¶
type CreateUserOption ¶
type CreateUserOption struct { SourceID int64 `json:"source_id"` LoginName string `json:"login_name"` Username string `json:"username" binding:"Required;AlphaDashDot;MaxSize(35)"` FullName string `json:"full_name" binding:"MaxSize(100)"` Email string `json:"email" binding:"Required;Email;MaxSize(254)"` Password string `json:"password" binding:"MaxSize(255)"` SendNotify bool `json:"send_notify"` }
type DeletePayload ¶
type DeletePayload struct { Ref string `json:"ref"` RefType string `json:"ref_type"` PusherType PusherType `json:"pusher_type"` Repo *Repository `json:"repository"` Sender *User `json:"sender"` }
func (*DeletePayload) JSONPayload ¶
func (p *DeletePayload) JSONPayload() ([]byte, error)
type EditHookOption ¶
type EditIssueCommentOption ¶
type EditIssueCommentOption struct {
Body string `json:"body" binding:"Required"`
}
EditIssueCommentOption is option when editing an issue comment.
type EditIssueOption ¶
type EditIssueTrackerOption ¶
type EditIssueTrackerOption struct { EnableIssues *bool `json:"enable_issues"` EnableExternalTracker *bool `json:"enable_external_tracker"` ExternalTrackerURL *string `json:"external_tracker_url"` TrackerURLFormat *string `json:"tracker_url_format"` TrackerIssueStyle *string `json:"tracker_issue_style"` }
type EditLabelOption ¶
type EditMilestoneOption ¶
type EditOrgOption ¶
type EditUserOption ¶
type EditUserOption struct { SourceID int64 `json:"source_id"` LoginName string `json:"login_name"` FullName string `json:"full_name" binding:"MaxSize(100)"` Email string `json:"email" binding:"Required;Email;MaxSize(254)"` Password string `json:"password" binding:"MaxSize(255)"` Website string `json:"website" binding:"MaxSize(50)"` Location string `json:"location" binding:"MaxSize(50)"` Active *bool `json:"active"` Admin *bool `json:"admin"` AllowGitHook *bool `json:"allow_git_hook"` AllowImportLocal *bool `json:"allow_import_local"` MaxRepoCreation *int `json:"max_repo_creation"` }
type EditWikiOption ¶
type ForkPayload ¶
type ForkPayload struct { Forkee *Repository `json:"forkee"` Repo *Repository `json:"repository"` Sender *User `json:"sender"` }
func (*ForkPayload) JSONPayload ¶
func (p *ForkPayload) JSONPayload() ([]byte, error)
type HookIssueAction ¶
type HookIssueAction string
const ( HOOK_ISSUE_OPENED HookIssueAction = "opened" HOOK_ISSUE_CLOSED HookIssueAction = "closed" HOOK_ISSUE_REOPENED HookIssueAction = "reopened" HOOK_ISSUE_EDITED HookIssueAction = "edited" HOOK_ISSUE_ASSIGNED HookIssueAction = "assigned" HOOK_ISSUE_UNASSIGNED HookIssueAction = "unassigned" HOOK_ISSUE_LABEL_UPDATED HookIssueAction = "label_updated" HOOK_ISSUE_LABEL_CLEARED HookIssueAction = "label_cleared" HOOK_ISSUE_MILESTONED HookIssueAction = "milestoned" HOOK_ISSUE_DEMILESTONED HookIssueAction = "demilestoned" HOOK_ISSUE_SYNCHRONIZED HookIssueAction = "synchronized" )
type HookIssueCommentAction ¶
type HookIssueCommentAction string
const ( HOOK_ISSUE_COMMENT_CREATED HookIssueCommentAction = "created" HOOK_ISSUE_COMMENT_EDITED HookIssueCommentAction = "edited" HOOK_ISSUE_COMMENT_DELETED HookIssueCommentAction = "deleted" )
type HookReleaseAction ¶
type HookReleaseAction string
const (
HOOK_RELEASE_PUBLISHED HookReleaseAction = "published"
)
type Issue ¶
type Issue struct { ID int64 `json:"id"` Index int64 `json:"number"` Poster *User `json:"user"` Title string `json:"title"` Body string `json:"body"` Labels []*Label `json:"labels"` Milestone *Milestone `json:"milestone"` Assignee *User `json:"assignee"` State StateType `json:"state"` Comments int `json:"comments"` Created time.Time `json:"created_at"` Updated time.Time `json:"updated_at"` PullRequest *PullRequestMeta `json:"pull_request"` }
type IssueCommentPayload ¶
type IssueCommentPayload struct { Action HookIssueCommentAction `json:"action"` Issue *Issue `json:"issue"` Comment *Comment `json:"comment"` Changes *ChangesPayload `json:"changes,omitempty"` Repository *Repository `json:"repository"` Sender *User `json:"sender"` }
IssueCommentPayload represents a payload information of issue comment event.
func (*IssueCommentPayload) JSONPayload ¶
func (p *IssueCommentPayload) JSONPayload() ([]byte, error)
type IssueLabelsOption ¶
type IssueLabelsOption struct {
Labels []int64 `json:"labels"`
}
type IssuesPayload ¶
type IssuesPayload struct { Action HookIssueAction `json:"action"` Index int64 `json:"number"` Issue *Issue `json:"issue"` Changes *ChangesPayload `json:"changes,omitempty"` Repository *Repository `json:"repository"` Sender *User `json:"sender"` }
IssuesPayload represents a payload information of issues event.
func (*IssuesPayload) JSONPayload ¶
func (p *IssuesPayload) JSONPayload() ([]byte, error)
type ListIssueOption ¶
type MarkdownOption ¶
type MigrateRepoOption ¶
type MigrateRepoOption struct { CloneAddr string `json:"clone_addr" binding:"Required"` AuthUsername string `json:"auth_username"` AuthPassword string `json:"auth_password"` UID int `json:"uid" binding:"Required"` RepoName string `json:"repo_name" binding:"Required"` Mirror bool `json:"mirror"` Private bool `json:"private"` Unlisted bool `json:"unlisted"` Description string `json:"description"` }
type Organization ¶
type PayloadCommit ¶
type PayloadCommit struct { ID string `json:"id"` Message string `json:"message"` URL string `json:"url"` Author *PayloadUser `json:"author"` Committer *PayloadUser `json:"committer"` Added []string `json:"added"` Removed []string `json:"removed"` Modified []string `json:"modified"` Timestamp time.Time `json:"timestamp"` }
FIXME: consider use same format as API when commits API are added.
type PayloadUser ¶
type Permission ¶
type Permission struct { Admin bool `json:"admin"` Push bool `json:"push"` Pull bool `json:"pull"` }
Permission represents a API permission.
type PullRequest ¶
type PullRequest struct { // Copied from issue.go ID int64 `json:"id"` Index int64 `json:"number"` Poster *User `json:"user"` Title string `json:"title"` Body string `json:"body"` Labels []*Label `json:"labels"` Milestone *Milestone `json:"milestone"` Assignee *User `json:"assignee"` State StateType `json:"state"` Comments int `json:"comments"` HeadBranch string `json:"head_branch"` HeadRepo *Repository `json:"head_repo"` BaseBranch string `json:"base_branch"` BaseRepo *Repository `json:"base_repo"` HTMLURL string `json:"html_url"` Mergeable *bool `json:"mergeable"` HasMerged bool `json:"merged"` Merged *time.Time `json:"merged_at"` MergedCommitID *string `json:"merge_commit_sha"` MergedBy *User `json:"merged_by"` }
PullRequest represents a pull reqesut API object.
type PullRequestMeta ¶
type PullRequestPayload ¶
type PullRequestPayload struct { Action HookIssueAction `json:"action"` Index int64 `json:"number"` PullRequest *PullRequest `json:"pull_request"` Changes *ChangesPayload `json:"changes,omitempty"` Repository *Repository `json:"repository"` Sender *User `json:"sender"` }
PullRequestPayload represents a payload information of pull request event.
func (*PullRequestPayload) JSONPayload ¶
func (p *PullRequestPayload) JSONPayload() ([]byte, error)
type PushPayload ¶
type PushPayload struct { Ref string `json:"ref"` Before string `json:"before"` After string `json:"after"` CompareURL string `json:"compare_url"` Commits []*PayloadCommit `json:"commits"` Repo *Repository `json:"repository"` Pusher *User `json:"pusher"` Sender *User `json:"sender"` }
PushPayload represents a payload information of push event.
func ParsePushHook ¶
func ParsePushHook(raw []byte) (*PushPayload, error)
ParsePushHook parses push event hook content.
func (*PushPayload) Branch ¶
func (p *PushPayload) Branch() string
Branch returns branch name from a payload
func (*PushPayload) JSONPayload ¶
func (p *PushPayload) JSONPayload() ([]byte, error)
type Release ¶
type Release struct { ID int64 `json:"id"` TagName string `json:"tag_name"` TargetCommitish string `json:"target_commitish"` Name string `json:"name"` Body string `json:"body"` Draft bool `json:"draft"` Prerelease bool `json:"prerelease"` Author *User `json:"author"` Created time.Time `json:"created_at"` }
Release represents a release API object.
type ReleasePayload ¶
type ReleasePayload struct { Action HookReleaseAction `json:"action"` Release *Release `json:"release"` Repository *Repository `json:"repository"` Sender *User `json:"sender"` }
ReleasePayload represents a payload information of release event.
func (*ReleasePayload) JSONPayload ¶
func (p *ReleasePayload) JSONPayload() ([]byte, error)
type RepoCommit ¶
type RepoCommit struct { URL string `json:"url"` Author *CommitUser `json:"author"` Committer *CommitUser `json:"committer"` Message string `json:"message"` Tree *CommitMeta `json:"tree"` }
RepoCommit contains information of a commit in the context of a repository.
type Repository ¶
type Repository struct { ID int64 `json:"id"` Owner *User `json:"owner"` Name string `json:"name"` FullName string `json:"full_name"` Description string `json:"description"` Private bool `json:"private"` Unlisted bool `json:"unlisted"` Fork bool `json:"fork"` Parent *Repository `json:"parent"` Empty bool `json:"empty"` Mirror bool `json:"mirror"` Size int64 `json:"size"` HTMLURL string `json:"html_url"` SSHURL string `json:"ssh_url"` CloneURL string `json:"clone_url"` Website string `json:"website"` Stars int `json:"stars_count"` Forks int `json:"forks_count"` Watchers int `json:"watchers_count"` OpenIssues int `json:"open_issues_count"` DefaultBranch string `json:"default_branch"` Created time.Time `json:"created_at"` Updated time.Time `json:"updated_at"` Permissions *Permission `json:"permissions,omitempty"` }
Repository represents a API repository.
type User ¶
type User struct { ID int64 `json:"id"` UserName string `json:"username"` // LEGACY [Gogs 1.0]: remove field(s) for backward compatibility Login string `json:"login"` FullName string `json:"full_name"` Email string `json:"email"` AvatarUrl string `json:"avatar_url"` }
User represents a API user.
Source Files ¶
- admin_org.go
- admin_repo.go
- admin_user.go
- gogs.go
- issue.go
- issue_comment.go
- issue_label.go
- issue_milestone.go
- media_types.go
- miscellaneous.go
- org.go
- org_member.go
- org_team.go
- pull.go
- release.go
- repo.go
- repo_branch.go
- repo_collaborator.go
- repo_commit.go
- repo_file.go
- repo_hook.go
- repo_key.go
- user.go
- user_app.go
- user_email.go
- user_follow.go
- user_key.go
- utils.go