cmd

package
v0.0.0-...-5e37864 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GITHUB_API = "https://api.github.com/users/%s/events"
	TRUNC_LEN  = 32
)
View Source
const (
	ACT_ADDED                  string = "addded"
	ACT_ASSIGNED               Action = "assigned"
	ACT_CLOSED                 Action = "closed"
	ACT_CREATED                Action = "created"
	ACT_DELETED                Action = "deleted"
	ACT_DEQUEUED               Action = "dequeued"
	ACT_EDITED                 Action = "edited"
	ACT_LABELED                Action = "labeled"
	ACT_OPENED                 Action = "opened"
	ACT_PUBLISHED              Action = "published"
	ACT_REOPENED               Action = "reopened"
	ACT_RESOLVED               Action = "resolved"
	ACT_REVIEW_REQUESTED       Action = "review_requested"
	ACT_REVIEW_REQUEST_REMOVED Action = "review_request_removed"
	ACT_SYNCHRONIZE            Action = "synchronize"
	ACT_UNASSIGNED             Action = "unassigned"
	ACT_UNLABELED              Action = "unlabeled"
	ACT_UNRESOLVED             Action = "unresolved"
)

Variables

This section is empty.

Functions

func Handle

func Handle(ctx *cli.Context) error

func New

func New() *cli.App

Types

type Action

type Action string

func (Action) String

func (a Action) String() string

type Author

type Author struct {
	Name  string `json:"name"`
	Email string `json:"email"`
}

The author of a commit

func (Author) String

func (a Author) String() string

type Comment

type Comment struct {
	Body string `json:"body"`
}

A comment on a issue/PR

type Commit

type Commit struct {
	Message  string `json:"message"`
	SHA      string `json:"string"`
	Author   Author `json:"author"`
	Distinct bool   `json:"distinct"`
}

A commit

func (Commit) String

func (c Commit) String() string

type Event

type Event struct {
	Type    EventType `json:"type"`
	Repo    Repo      `json:"repo"`
	Payload Payload   `json:"payload"`
}

Represents a Github Event

This doesn't actually hold all of the data that is received, only the data relevant to us

type EventPrinter

type EventPrinter func(Event)

type EventType

type EventType string

All possible events the API can provide us

const (
	COMMIT_COMMENT_EVENT              EventType = "CommitCommentEvent"
	CREATE_EVENT                      EventType = "CreateEvent"
	DELETE_EVENT                      EventType = "DeleteEvent"
	FORK_EVENT                        EventType = "ForkEvent"
	GOLLUM_EVENT                      EventType = "GollumEvent"
	ISSUE_COMMENT_EVENT               EventType = "IssueCommentEvent"
	ISSUES_EVENT                      EventType = "IssuesEvent"
	MEMBER_EVENT                      EventType = "MemberEvent"
	PUBLIC_EVENT                      EventType = "PublicEvent"
	PULL_REQUEST_EVENT                EventType = "PullRequestEvent"
	PULL_REQUEST_REVIEW_EVENT         EventType = "PullRequestReviewEvent"
	PULL_REQUEST_REVIEW_COMMENT_EVENT EventType = "PullRequestReviewCommentEvent"
	PULL_REQUEST_REVIEW_THREAD_EVENT  EventType = "PullRequestReviewThreadEvent"
	PUSH_EVENT                        EventType = "PushEvent"
	RELEASE_EVENT                     EventType = "ReleaseEvent"
	SPONSORSHIP_EVENT                 EventType = "SponsorshipEvent"
	WATCH_EVENT                       EventType = "WatchEvent"
)

type Issue

type Issue struct {
	Number json.Number `json:"number"`
	Title  string      `json:"title"`
	State  string      `json:"state"`
	User   User        `json:"login"`
}

An issue

func (Issue) String

func (i Issue) String() string

type Page

type Page struct {
	PageName string `json:"page_name"`
	Title    string `json:"title"`
	Action   Action `json:"action"`
	HTMLUrl  string `json:"html_url"`
}

Represents a wiki Page

func (Page) String

func (p Page) String() string

type Payload

type Payload struct {
	Action      Action      `json:"action"`
	Ref         string      `json:"ref"`
	Assignee    User        `json:"assignee"`
	Member      User        `json:"member"`
	Reason      string      `json:"reason"`
	Release     Release     `json:"release"`
	Size        json.Number `json:"size"`
	Forkee      Repo        `json:"forkee"`
	RefType     RefType     `json:"ref_type"`
	Comment     Comment     `json:"comment"`
	Review      Review      `json:"review"`
	PullRequest PullRequest `json:"pull_request"`
	Issue       Issue       `json:"issue"`
	Pages       []Page      `json:"pages"`
	Commits     []Commit    `json:"commits"`
}

Represents the actual important data in an event

This varies a lot (*A LOT* a lot) from event to event, so make sure to check the EventType value in the Event to make sure you're accessing the correct payload data

type PullRequest

type PullRequest struct {
	Number json.Number `json:"number"`
	Title  string      `json:"title"`
	State  string      `json:"state"`
	User   User        `json:"login"`
}

A PR

func (PullRequest) String

func (pr PullRequest) String() string

type RefType

type RefType string
const (
	RT_BRANCH RefType = "branch"
	RT_TAG    RefType = "tag"
	RT_REPO   RefType = "repository"
)

type Release

type Release struct {
	Title string `json:"title"`
}

type Repo

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

Represents the repository in which the event happened

type Review

type Review struct {
	State string `json:"state"`
}

A review of a commit

type User

type User struct {
	Login string `json:"login"`
}

Represents a Github user

Jump to

Keyboard shortcuts

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