Help us shape the future of Go! Take the 2026 Go Developer Survey

github

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrValidationFailed = fmt.Errorf("validation failed")

ErrValidationFailed is returned when GitHub returns a 422 Validation Failed response.

Functions

func UpdateContent

func UpdateContent(parsed *ParsedURL, item ContentItem, newBody string) error

UpdateContent updates a single content item on GitHub.

func UpdateTitle added in v0.4.0

func UpdateTitle(parsed *ParsedURL, item ContentItem, newTitle string) error

UpdateTitle updates the title of a PR, Issue, or Discussion on GitHub.

Types

type ContentItem

type ContentItem struct {
	Type       ContentType
	NodeID     string // GraphQL node ID (used for Discussion operations)
	DatabaseID int64  // REST numeric ID (used for Issue/Review comment operations)
	Number     int    // PR/Issue number (used for body updates)
	Title      string // PR/Issue/Discussion title (empty for comments)
	Body       string
	IsBot      bool // true if the author is a bot
}

ContentItem represents a single piece of content to translate. The ID field used for updates depends on ContentType:

  • PR/Issue body → Number
  • Issue comment / Review comment → DatabaseID
  • Discussion body / comment / reply → NodeID

func FetchContent

func FetchContent(parsed *ParsedURL, bodyOnly bool) ([]ContentItem, error)

FetchContent fetches all content items for the given parsed URL.

type ContentType

type ContentType string

ContentType represents the type of GitHub content to translate.

const (
	ContentTypePRBody            ContentType = "pr_body"
	ContentTypeIssueBody         ContentType = "issue_body"
	ContentTypeDiscussionBody    ContentType = "discussion_body"
	ContentTypeIssueComment      ContentType = "issue_comment"
	ContentTypeReviewComment     ContentType = "review_comment"
	ContentTypeDiscussionComment ContentType = "discussion_comment"
)

type ParsedURL

type ParsedURL struct {
	Owner  string
	Repo   string
	Type   string // "pull", "issues", "discussions"
	Number int
}

ParsedURL holds the parsed components of a GitHub URL.

func ParseURL

func ParseURL(rawURL string) (*ParsedURL, error)

ParseURL parses a GitHub URL into its components.

Jump to

Keyboard shortcuts

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