event

package
v0.0.0-...-f564348 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2023 License: MIT Imports: 5 Imported by: 5

Documentation

Overview

Package event defines event types.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Change

type Change struct {
	Action        string // "opened", "closed", "merged", "reopened".
	ChangeTitle   string
	ChangeBody    string // Only set when action is "opened".
	ChangeHTMLURL string
}

Change is a change event.

type ChangeComment

type ChangeComment struct {
	ChangeTitle    string
	ChangeState    state.Change
	CommentBody    string
	CommentReview  state.Review
	CommentHTMLURL string
}

ChangeComment is a change comment event. A change comment is a review iff CommentReview is non-zero.

type Commit

type Commit struct {
	SHA             string
	Message         string
	AuthorAvatarURL string
	HTMLURL         string // Optional.
}

Commit describes a commit in a CommitComment or Push event.

type CommitComment

type CommitComment struct {
	Commit      Commit
	CommentBody string
}

CommitComment is a commit comment event.

type Create

type Create struct {
	Type        string // "repository", "package", "branch", "tag".
	Name        string // Only for "branch", "tag" types.
	Description string // Only for "repository", "package" types. Optional.
}

Create is a create event.

type Delete

type Delete struct {
	Type string // "branch", "tag".
	Name string
}

Delete is a delete event.

type Event

type Event struct {
	Time  time.Time
	Actor users.User // UserSpec and Login fields populated.

	// Container is the URL (without schema) of event target.
	//
	// For event types Issue, Change, IssueComment, ChangeComment, CommitComment,
	// and Create with "package" type, it's the import path of the target package.
	// E.g., "golang.org/x/image/font/sfnt" or "github.com/user/repo/sub/dir".
	//
	// For all other event types, it is the module path of the target repository.
	// E.g., "golang.org/x/image" or "github.com/user/repo".
	Container string

	// Payload specifies the event type. It's one of:
	// Issue, Change, IssueComment, ChangeComment, CommitComment,
	// Push, Star, Create, Fork, Delete, Wiki.
	Payload interface{}
}

Event represents an event.

func (Event) MarshalJSON

func (e Event) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface.

func (*Event) UnmarshalJSON

func (e *Event) UnmarshalJSON(b []byte) error

UnmarshalJSON implements the json.Unmarshaler interface.

type Fork

type Fork struct {
	Container string // URL (without schema) of the created repository. E.g., "github.com/anotheruser/repo".
}

Fork is a fork event.

type Issue

type Issue struct {
	Action       string // "opened", "closed", "reopened".
	IssueTitle   string
	IssueBody    string // Only set when action is "opened".
	IssueHTMLURL string
}

Issue is an issue event.

type IssueComment

type IssueComment struct {
	IssueTitle     string
	IssueState     state.Issue
	CommentBody    string
	CommentHTMLURL string
}

IssueComment is an issue comment event.

type Page

type Page struct {
	Action         string // "created", "edited".
	SHA            string
	Title          string
	HTMLURL        string
	CompareHTMLURL string
}

Page describes a page action in a Wiki event.

type Push

type Push struct {
	Branch  string   // Name of branch pushed to. E.g., "master".
	Head    string   // SHA of the most recent commit after the push.
	Before  string   // SHA of the most recent commit before the push.
	Commits []Commit // Ordered from earliest to most recent (head).

	HeadHTMLURL   string // Optional.
	BeforeHTMLURL string // Optional.
}

Push is a push event.

type Star

type Star struct{}

Star is a star event.

type Wiki

type Wiki struct {
	Pages []Page // Wiki pages that are affected.
}

Wiki is a wiki event. It happens when an actor updates a wiki.

Jump to

Keyboard shortcuts

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