format

package
v0.0.0-...-f2266cd Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2022 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Overview

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

Index

Constants

View Source
const (
	RepositoryNameDefault = ""
	RepositoryNameWiki    = ".wiki"
)
View Source
const (
	ReviewStatePending          = "PENDING"
	ReviewStateApproved         = "APPROVED"
	ReviewStateChangesRequested = "CHANGES_REQUESTED"
	ReviewStateCommented        = "COMMENTED"
	ReviewStateRequestReview    = "REQUEST_REVIEW"
	ReviewStateUnknown          = ""
)

enumerate all review states

Variables

View Source
var RepositoryDefault = &Repository{Name: RepositoryNameDefault}

Functions

func Load

func Load(filename string, data interface{}, validation bool) error

Load project data from file, with optional validation

func Store

func Store(filename string, data interface{}) error

Types

type Comment

type Comment struct {
	IssueIndex  int64       `json:"issue_index"`
	Index       int64       `json:"index"`
	PosterID    int64       `json:"poster_id"`
	PosterName  string      `json:"poster_name"`
	PosterEmail string      `json:"poster_email"`
	Created     time.Time   `json:"created"`
	Updated     time.Time   `json:"updated"`
	Content     string      `json:"content"`
	Reactions   []*Reaction `json:"reactions"`
}

Comment is a standard comment information

func (*Comment) GetExternalID

func (c *Comment) GetExternalID() int64

ExternalID ExternalUserMigrated interface

func (*Comment) GetExternalName

func (c *Comment) GetExternalName() string

GetExternalName ExternalUserMigrated interface

func (*Comment) GetID

func (c *Comment) GetID() int64

func (*Comment) SetID

func (c *Comment) SetID(id int64)

type Commentable

type Commentable interface {
	GetID() int64
}

Commentable can be commented upon

type Issue

type Issue struct {
	Number      int64       `json:"number"`
	PosterID    int64       `json:"poster_id"`
	PosterName  string      `json:"poster_name"`
	PosterEmail string      `json:"poster_email"`
	Title       string      `json:"title"`
	Content     string      `json:"content"`
	Milestone   string      `json:"milestone"`
	State       string      `json:"state"` // closed, open
	IsLocked    bool        `json:"is_locked"`
	Created     time.Time   `json:"created"`
	Updated     time.Time   `json:"updated"`
	Closed      *time.Time  `json:"closed"`
	Labels      []*Label    `json:"labels"`
	Reactions   []*Reaction `json:"reactions"`
	Assignees   []string    `json:"assignees"`
	Ref         string      `json:"ref"`
}

Issue is a standard issue information

func (*Issue) GetExternalID

func (i *Issue) GetExternalID() int64

GetExternalID ExternalUserMigrated interface

func (*Issue) GetExternalName

func (i *Issue) GetExternalName() string

GetExternalName ExternalUserMigrated interface

func (*Issue) GetID

func (i *Issue) GetID() int64

func (*Issue) GetLocalIndex

func (i *Issue) GetLocalIndex() int64

func (*Issue) SetID

func (i *Issue) SetID(id int64)

type Label

type Label struct {
	Index       int64  `json:"index"`
	Name        string `json:"name"`
	Color       string `json:"color"`
	Description string `json:"description"`
}

Label defines a standard label information

func (*Label) GetID

func (l *Label) GetID() int64

func (*Label) SetID

func (l *Label) SetID(id int64)

type Milestone

type Milestone struct {
	Index       int64      `json:"index"`
	Title       string     `json:"title"`
	Description string     `json:"description"`
	Deadline    *time.Time `json:"deadline"`
	Created     time.Time  `json:"created"`
	Updated     *time.Time `json:"updated"`
	Closed      *time.Time `json:"closed"`
	State       string     `json:"state"` // open, closed
}

Milestone defines a standard milestone

func (*Milestone) GetID

func (m *Milestone) GetID() int64

func (*Milestone) SetID

func (m *Milestone) SetID(id int64)

type Project

type Project struct {
	Index         int64  `json:"index"`
	Name          string `json:"name"`
	Owner         string `json:"owner"`
	IsPrivate     bool   `json:"is_private"`
	IsMirror      bool   `json:"is_mirror"`
	Description   string `json:"description"`
	CloneURL      string `json:"clone_url"`
	OriginalURL   string `json:"original_url"`
	DefaultBranch string `json:"default_branch"`
}

Project project

func (*Project) GetID

func (p *Project) GetID() int64

func (*Project) SetID

func (p *Project) SetID(id int64)

type PullRequest

type PullRequest struct {
	Number         int64             `json:"number"`
	PosterID       int64             `json:"poster_id"`
	PosterName     string            `json:"poster_name"`
	PosterEmail    string            `json:"poster_email"`
	Title          string            `json:"title"`
	Content        string            `json:"content"`
	Milestone      string            `json:"milestone"`
	State          string            `json:"state"` // closed, open
	IsLocked       bool              `json:"is_locked"`
	Created        time.Time         `json:"created"`
	Updated        time.Time         `json:"updated"`
	Closed         *time.Time        `json:"closed"`
	Labels         []*Label          `json:"labels"`
	Reactions      []*Reaction       `json:"reactions"`
	Assignees      []string          `json:"assignees"`
	PatchURL       string            `json:"patch_url"`
	Merged         bool              `json:"merged"`
	MergedTime     *time.Time        `json:"merged_time"`
	MergeCommitSHA string            `json:"merged_commit_sha"`
	Head           PullRequestBranch `json:"head"`
	Base           PullRequestBranch `json:"base"`

	Fetch func(directory string) string `json:"-"`
}

PullRequest defines a standard pull request information

func (*PullRequest) GetExternalID

func (p *PullRequest) GetExternalID() int64

ExternalID ExternalUserMigrated interface

func (*PullRequest) GetExternalName

func (p *PullRequest) GetExternalName() string

GetExternalName ExternalUserMigrated interface

func (PullRequest) GetGitRefName

func (p PullRequest) GetGitRefName() string

GetGitRefName returns pull request relative path to head

func (*PullRequest) GetID

func (p *PullRequest) GetID() int64

func (*PullRequest) GetLocalIndex

func (p *PullRequest) GetLocalIndex() int64

func (*PullRequest) IsForkPullRequest

func (p *PullRequest) IsForkPullRequest() bool

IsForkPullRequest returns true if the pull request from a forked repository but not the same repository

func (*PullRequest) SetID

func (p *PullRequest) SetID(id int64)

type PullRequestBranch

type PullRequestBranch struct {
	CloneURL  string `json:"clone_url"`
	Ref       string `json:"ref"`
	SHA       string `json:"sha"`
	RepoName  string `json:"repo_name"`
	OwnerName string `json:"owner_name"`
}

PullRequestBranch represents a pull request branch

func (PullRequestBranch) RepoPath

func (p PullRequestBranch) RepoPath() string

RepoPath returns pull request repo path

type Reaction

type Reaction struct {
	UserID   int64  `json:"user_id"`
	UserName string `json:"user_name"`
	Content  string `json:"content"`
}

Reaction represents a reaction to an issue/pr/comment.

func (*Reaction) GetExternalID

func (r *Reaction) GetExternalID() int64

GetExternalID ExternalUserMigrated interface

func (*Reaction) GetExternalName

func (r *Reaction) GetExternalName() string

GetExternalName ExternalUserMigrated interface

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"`
	PublisherID     int64           `json:"publisher_id"`
	PublisherName   string          `json:"publisher_name"`
	PublisherEmail  string          `json:"publisher_email"`
	Assets          []*ReleaseAsset `json:"assets"`
	Created         time.Time       `json:"created"`
	Published       time.Time       `json:"published"`
}

Release represents a release

func (*Release) AssetPath

func (r *Release) AssetPath(ID int64) string

func (*Release) GetExternalID

func (r *Release) GetExternalID() int64

GetExternalID ExternalUserMigrated interface

func (*Release) GetExternalName

func (r *Release) GetExternalName() string

GetExternalName ExternalUserMigrated interface

func (*Release) GetID

func (r *Release) GetID() int64

func (*Release) SetID

func (r *Release) SetID(id int64)

type ReleaseAsset

type ReleaseAsset struct {
	ID            int64                `json:"id"`
	Name          string               `json:"name"`
	ContentType   *string              `json:"content_type"`
	Size          *int                 `json:"size"`
	DownloadCount *int                 `json:"download_count"`
	Created       time.Time            `json:"created"`
	Updated       time.Time            `json:"updated"`
	DownloadURL   *string              `json:"download_url"`
	DownloadFunc  func() io.ReadCloser `json:"-"`
}

ReleaseAsset represents a release asset

func (*ReleaseAsset) GetID

func (r *ReleaseAsset) GetID() int64

func (*ReleaseAsset) SetID

func (r *ReleaseAsset) SetID(id int64)

type Repository

type Repository struct {
	Name string `json:"name"`

	Fetch func(directory string) `json:"-"`
}

type Review

type Review struct {
	ID           int64            `json:"id"`
	IssueIndex   int64            `json:"issue_index"`
	ReviewerID   int64            `json:"reviewer_id"`
	ReviewerName string           `json:"reviewer_name"`
	Official     bool             `json:"official"`
	CommitID     string           `json:"commit_id"`
	Content      string           `json:"content"`
	CreatedAt    time.Time        `json:"created_at"`
	State        string           `json:"state"`
	Comments     []*ReviewComment `json:"comments"`
}

Review is a standard review information

func (*Review) GetExternalID

func (r *Review) GetExternalID() int64

ExternalID ExternalUserMigrated interface

func (*Review) GetExternalName

func (r *Review) GetExternalName() string

GetExternalName ExternalUserMigrated interface

func (*Review) GetID

func (r *Review) GetID() int64

func (*Review) SetID

func (r *Review) SetID(id int64)

type ReviewComment

type ReviewComment struct {
	ID        int64       `json:"id"`
	InReplyTo int64       `json:"in_reply_to"`
	Content   string      `json:"content"`
	TreePath  string      `json:"tree_path"`
	DiffHunk  string      `json:"diff_hunk"`
	Position  int         `json:"position"`
	Line      int         `json:"line"`
	CommitID  string      `json:"commit_id"`
	PosterID  int64       `json:"poster_id"`
	Reactions []*Reaction `json:"reactions"`
	CreatedAt time.Time   `json:"created_at"`
	UpdatedAt time.Time   `json:"updated_at"`
}

ReviewComment represents a review comment

func (*ReviewComment) GetID

func (r *ReviewComment) GetID() int64

func (*ReviewComment) SetID

func (r *ReviewComment) SetID(id int64)

type ReviewIndexType

type ReviewIndexType struct {
	PullRequestID int64
	ReviewID      int64
}

type Reviewable

type Reviewable interface {
	GetID() int64
}

Reviewable can be reviewed

type Topic

type Topic struct {
	Name string `json:"name"`
}

Topic topic

Jump to

Keyboard shortcuts

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