model

package
v0.0.0-...-76a6b52 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2025 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package model defines some types used within the ent schemas.

Index

Constants

This section is empty.

Variables

View Source
var EventsMissedData io.Writer

EventsMissedData can be set if TimelineEventWrapper.UnmarshalJSON should log data (JSON fields) missed while unmarshalling. A warning will be logged on stderr, and the log of the missed data will be written to this writer.

Functions

This section is empty.

Types

type AddedToProjectIssueEvent

type AddedToProjectIssueEvent struct {
	ProjectCard *ProjectCard `json:"project_card"`
	// contains filtered or unexported fields
}

func (AddedToProjectIssueEvent) Name

type AuthorAssociation

type AuthorAssociation string

AuthorAssociation is an enum of possible associations of an issue or issue comment's author, with the repository of the issue.

const (
	AssociationCollaborator         AuthorAssociation = "COLLABORATOR"
	AssociationContributor          AuthorAssociation = "CONTRIBUTOR"
	AssociationFirstTimer           AuthorAssociation = "FIRST_TIMER"
	AssociationFirstTimeContributor AuthorAssociation = "FIRST_TIME_CONTRIBUTOR"
	AssociationMannequin            AuthorAssociation = "MANNEQUIN"
	AssociationMember               AuthorAssociation = "MEMBER"
	AssociationOwner                AuthorAssociation = "OWNER"
	AssociationNone                 AuthorAssociation = "NONE"
)

Possible values of AuthorAssociation.

func (AuthorAssociation) Values

func (AuthorAssociation) Values() []string

Values returns the possible values of an AuthorAssociation.

type ClosedEvent

type ClosedEvent struct {
	StateReason StateReason `json:"state_reason"`
	// contains filtered or unexported fields
}

func (ClosedEvent) Name

func (ClosedEvent) Name() string

type CommitUser

type CommitUser struct {
	Date  time.Time `json:"date"`
	Email string    `json:"email"`
	Name  string    `json:"name"`
}

type ConvertedNoteToIssueIssueEvent

type ConvertedNoteToIssueIssueEvent struct {
	ProjectCard *ProjectCard `json:"project_card"`
	// contains filtered or unexported fields
}

func (ConvertedNoteToIssueIssueEvent) Name

type DemilestonedIssueEvent

type DemilestonedIssueEvent struct {
	Milestone struct {
		Title string `json:"title"`
	} `json:"milestone"`
	// contains filtered or unexported fields
}

DemilestonedIssueEvent is the GitHub event for when an issue has its milestone removed.

func (DemilestonedIssueEvent) Name

Name is used to associate this type with the demilestoned event.

type LabeledIssueEvent

type LabeledIssueEvent struct {
	Label struct {
		Name  string `json:"name"`
		Color string `json:"color"`
	} `json:"label"`
	// contains filtered or unexported fields
}

LabeledIssueEvent is the GitHub event for when an issue is labeled.

func (LabeledIssueEvent) Name

func (LabeledIssueEvent) Name() string

Name is used to associate this type with the labeled event.

type License

type License struct {
	Key    string `json:"key"`
	Name   string `json:"name"`
	URL    string `json:"url"`
	NodeID string `json:"node_id"`
	SpdxID string `json:"spdx_id"`
}

License is a License on the GitHub API. In the schema, this is nullable-license-simple.

type LockedIssueEvent

type LockedIssueEvent struct {
	LockReason *string `json:"lock_reason"`
	// contains filtered or unexported fields
}

LockedIssueEvent is the GitHub event for when a conversation on an issue is locked.

func (LockedIssueEvent) Name

func (LockedIssueEvent) Name() string

Name is used to associate this type with the locked event.

type MilestonedIssueEvent

type MilestonedIssueEvent struct {
	Milestone struct {
		Title string `json:"title"`
	} `json:"milestone"`
	// contains filtered or unexported fields
}

MilestonedIssueEvent is the GitHub event for when an issue is milestoned.

func (MilestonedIssueEvent) Name

Name is used to associate this type with the milestone event.

type MovedColumnsInProjectIssueEvent

type MovedColumnsInProjectIssueEvent struct {
	ProjectCard *ProjectCard `json:"project_card"`
	// contains filtered or unexported fields
}

func (MovedColumnsInProjectIssueEvent) Name

type NoCopyTemplate

type NoCopyTemplate struct{}

NoCopyTemplate is an ent annotation that can be used to mark when a field shouldn't be placed in the "copy" template; ie. it should not be possible to copy it from an existing structure.

func (NoCopyTemplate) Name

func (n NoCopyTemplate) Name() string

type PRBranch

type PRBranch struct {
	Label string           `json:"label"`
	Ref   string           `json:"ref"`
	Sha   string           `json:"sha"`
	User  SimpleUser       `json:"user"`
	Repo  SimpleRepository `json:"repo"`
}

PRBranch is the representation of a branch.

type ProjectCard

type ProjectCard struct {
	ID                 int64  `json:"id"`
	URL                string `json:"url"`
	ProjectID          int64  `json:"project_id"`
	ProjectURL         string `json:"project_url"`
	ColumnName         string `json:"column_name"`
	PreviousColumnName string `json:"previous_column_name,omitempty"`
}

type ReactionRollup

type ReactionRollup struct {
	ThumbsUp   int    `json:"+1"`
	ThumbsDown int    `json:"-1"`
	Confused   int    `json:"confused"`
	Eyes       int    `json:"eyes"`
	Heart      int    `json:"heart"`
	Hooray     int    `json:"hooray"`
	Laugh      int    `json:"laugh"`
	Rocket     int    `json:"rocket"`
	TotalCount int    `json:"total_count"`
	URL        string `json:"url"`
}

ReactionRollup associates to each reaction a number of users who clicked it.

type RemovedFromProjectIssueEvent

type RemovedFromProjectIssueEvent struct {
	ProjectCard *ProjectCard `json:"project_card"`
	// contains filtered or unexported fields
}

func (RemovedFromProjectIssueEvent) Name

type RenamedIssueEvent

type RenamedIssueEvent struct {
	Rename struct {
		From string `json:"from"`
		To   string `json:"to"`
	} `json:"rename"`
	// contains filtered or unexported fields
}

RenamedIssueEvent is the GitHub event for when an issue is renamed.

func (RenamedIssueEvent) Name

func (RenamedIssueEvent) Name() string

Name is used to associate this type with the renamed event.

type ReopenedEvent

type ReopenedEvent struct {
	StateReason StateReason `json:"state_reason"`
	// contains filtered or unexported fields
}

func (ReopenedEvent) Name

func (ReopenedEvent) Name() string

type ReviewDismissedIssueEvent

type ReviewDismissedIssueEvent struct {
	DismissedReview struct {
		State             string  `json:"state"`
		ReviewID          int     `json:"review_id"`
		DismissalMessage  *string `json:"dismissal_message"`
		DismissalCommitID string  `json:"dismissal_commit_id"`
	} `json:"dismissed_review"`
	// contains filtered or unexported fields
}

ReviewDismissedIssueEvent is the GitHub event for when a review on an issue (PR) is dismissed.

func (ReviewDismissedIssueEvent) Name

Name is used to associate this type with the review_dismissed event.

type ReviewRequestRemovedIssueEvent

type ReviewRequestRemovedIssueEvent struct {
	ReviewRequester SimpleUser `json:"review_requester"`
	RequestedTeam   *struct {
		ID   int    `json:"id"`
		Name string `json:"name"`
		Slug string `json:"slug"`
	} `json:"requested_team,omitempty"`
	RequestedReviewer *SimpleUser `json:"requested_reviewer,omitempty"`
	// contains filtered or unexported fields
}

ReviewRequestRemovedIssueEvent is the GitHub event for when an issue (PR) has one of its existing review requests removed.

func (ReviewRequestRemovedIssueEvent) Name

Name is used to associate this type with the review_request_removed event.

type ReviewRequestedIssueEvent

type ReviewRequestedIssueEvent struct {
	ReviewRequester SimpleUser `json:"review_requester"`
	RequestedTeam   *struct {
		ID   int    `json:"id"`
		Name string `json:"name"`
		Slug string `json:"slug"`
	} `json:"requested_team,omitempty"`
	RequestedReviewer *SimpleUser `json:"requested_reviewer,omitempty"`
	// contains filtered or unexported fields
}

ReviewRequestedIssueEvent is the GitHub event for when an issue (PR) receives a new review request.

func (ReviewRequestedIssueEvent) Name

Name is used to associate this type with the review_requested event.

type SimpleEvent

type SimpleEvent struct {
	Event string `json:"event"`
	// contains filtered or unexported fields
}

SimpleEvent is used for the events which don't have additional information.

func (SimpleEvent) Name

func (ev SimpleEvent) Name() string

type SimpleIssue

type SimpleIssue struct {
	ID         int64            `json:"id"`
	Number     int64            `json:"number"`
	Repository SimpleRepository `json:"repository"`
}

SimpleIssue is a reduced issue struct, keeping track of important information but avoiding redundancy.

type SimpleRepository

type SimpleRepository struct {
	ID       int64      `json:"id"`
	Name     string     `json:"name"`
	FullName string     `json:"full_name"`
	Owner    SimpleUser `json:"owner"`
}

SimpleRepository is a reduced issue struct, keeping track of important information but avoiding redundancy.

type SimpleUser

type SimpleUser struct {
	Login string `json:"login"`
	ID    int64  `json:"id"`
}

SimpleUser is used to keep track of user information in events. The GitHub API actually contains more information, but for our purposes it redundant.

type StateReason

type StateReason string

StateReason is the reason an issue was closed or reopened.

const (
	StateReasonCompleted  StateReason = "completed"
	StateReasonReopened   StateReason = "reopened"
	StateReasonNotPlanned StateReason = "not_planned"
)

Possible values of StateReason.

func (StateReason) Values

func (StateReason) Values() []string

Values returns the possible values of a StateReason.

type TimelineAssignedIssueEvent

type TimelineAssignedIssueEvent struct {
	Assignee SimpleUser `json:"assignee"`
	// contains filtered or unexported fields
}

func (TimelineAssignedIssueEvent) Name

type TimelineCommentEvent

type TimelineCommentEvent struct {
	Body              string            `json:"body"`
	BodyText          string            `json:"body_text"`
	BodyHTML          string            `json:"body_html"`
	HTML_URL          string            `json:"html_url"`
	User              SimpleUser        `json:"user"`
	UpdatedAt         time.Time         `json:"updated_at"`
	IssueUrl          string            `json:"issue_url"`
	AuthorAssociation AuthorAssociation `json:"author_association"`
	Reactions         ReactionRollup    `json:"reactions"`
	// contains filtered or unexported fields
}

func (TimelineCommentEvent) Name

type TimelineCommittedEvent

type TimelineCommittedEvent struct {
	Sha       string     `json:"sha"`
	Author    CommitUser `json:"author"`
	Committer CommitUser `json:"committer"`
	Message   string     `json:"message"`
	Tree      struct {
		Sha string `json:"sha"`
		URL string `json:"url"`
	} `json:"tree"`
	Parents []struct {
		Sha      string `json:"sha"`
		URL      string `json:"url"`
		HTML_URL string `json:"html_url"`
	} `json:"parents"`
	Verification VerificationInfo `json:"verification"`
	HtmlUrl      string           `json:"html_url"`
	// contains filtered or unexported fields
}

func (TimelineCommittedEvent) Name

type TimelineCrossReferencedEvent

type TimelineCrossReferencedEvent struct {
	UpdatedAt time.Time `json:"updated_at"`
	Source    struct {
		Type  string      `json:"type"`
		Issue SimpleIssue `json:"issue"`
	} `json:"source"`
	// contains filtered or unexported fields
}

func (TimelineCrossReferencedEvent) Name

type TimelineEvent

type TimelineEvent interface {
	Name() string
	// contains filtered or unexported methods
}

TimelineEvent is the interface for all of the timeline events.

type TimelineEventWrapper

type TimelineEventWrapper struct {
	TimelineEvent
}

TimelineEventWrapper wraps all TimelineEvents, unmarshaling JSON data into the appropriate type by looking at its "events" key.

func (TimelineEventWrapper) MarshalJSON

func (ew TimelineEventWrapper) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler. This will not encode a full GitHub event; but it will enrichen the underlying event's marshaling with the event's name.

func (*TimelineEventWrapper) UnmarshalJSON

func (ew *TimelineEventWrapper) UnmarshalJSON(b []byte) (resultErr error)

UnmarshalJSON implements json.Unmarshaler. It expects a JSON object with field "event", identifying the name of the event.

type TimelineReviewedEvent

type TimelineReviewedEvent struct {
	User           SimpleUser `json:"user"`
	Body           string     `json:"body"`
	State          string     `json:"state"`
	HtmlUrl        string     `json:"html_url"`
	PullRequestUrl string     `json:"pull_request_url"`
	Links          struct {
		Html struct {
			Href string `json:"href"`
		} `json:"html"`
		PullRequest struct {
			Href string `json:"href"`
		} `json:"pull_request"`
	} `json:"_links"`
	SubmittedAt       time.Time         `json:"submitted_at"`
	BodyHtml          string            `json:"body_html"`
	BodyText          string            `json:"body_text"`
	AuthorAssociation AuthorAssociation `json:"author_association"`
	// contains filtered or unexported fields
}

func (TimelineReviewedEvent) Name

type TimelineUnassignedIssueEvent

type TimelineUnassignedIssueEvent struct {
	Assignee SimpleUser `json:"assignee"`
	// contains filtered or unexported fields
}

func (TimelineUnassignedIssueEvent) Name

type UnlabeledIssueEvent

type UnlabeledIssueEvent struct {
	Label struct {
		Name  string `json:"name"`
		Color string `json:"color"`
	} `json:"label"`
	// contains filtered or unexported fields
}

UnlabeledIssueEvent is the GitHub event for when an issue is labeled.

func (UnlabeledIssueEvent) Name

func (UnlabeledIssueEvent) Name() string

Name is used to associate this type with the unlabeled event.

type UnlockedIssueEvent

type UnlockedIssueEvent struct {
	LockReason *string `json:"lock_reason"`
	// contains filtered or unexported fields
}

UnlockedIssueEvent is the GitHub event for when a conversation on an issue is unlocked.

func (UnlockedIssueEvent) Name

func (UnlockedIssueEvent) Name() string

Name is used to associate this type with the locked event.

type VerificationInfo

type VerificationInfo struct {
	Verified  bool   `json:"verified"`
	Reason    string `json:"reason"`
	Signature string `json:"signature"`
	Payload   string `json:"payload"`
}

Directories

Path Synopsis
internal
jsoncatcher
Package jsoncatcher compares re-emitted, parsed JSON data with its raw counterpart to find fields which have not been correctly parsed.
Package jsoncatcher compares re-emitted, parsed JSON data with its raw counterpart to find fields which have not been correctly parsed.

Jump to

Keyboard shortcuts

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