github

package
v0.1.0-beta.1 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2025 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Comment

type Comment struct {
	ID        int       `json:"id"`
	Body      string    `json:"body"`
	User      User      `json:"user"`
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`

	// Review comment specific fields
	Path     string `json:"path,omitempty"`
	Line     int    `json:"line,omitempty"`
	Position int    `json:"position,omitempty"`

	// Computed fields
	Type string `json:"-"` // "issue" or "review"
}

Comment represents a GitHub comment (issue or review)

type GitHubAPI

type GitHubAPI interface {
	// Comment operations
	ListIssueComments(owner, repo string, prNumber int) ([]Comment, error)
	ListReviewComments(owner, repo string, prNumber int) ([]Comment, error)
	CreateIssueComment(owner, repo string, prNumber int, body string) (*Comment, error)
	CreateReviewCommentReply(owner, repo string, commentID int, body string) (*Comment, error)

	// GraphQL operations
	ResolveReviewThread(threadID string) error
	FindReviewThreadForComment(owner, repo string, prNumber, commentID int) (string, error)
}

GitHubAPI defines the interface for GitHub API operations

type MockClient

type MockClient struct {
	IssueComments  []Comment
	ReviewComments []Comment
	CreatedComment *Comment
	ResolvedThread string

	// Error simulation
	ListIssueCommentsError  error
	ListReviewCommentsError error
	CreateCommentError      error
	ResolveThreadError      error
}

MockClient implements GitHubAPI for testing

func NewMockClient

func NewMockClient() *MockClient

NewMockClient creates a new mock client for testing

func (*MockClient) CreateIssueComment

func (m *MockClient) CreateIssueComment(owner, repo string, prNumber int, body string) (*Comment, error)

func (*MockClient) CreateReviewCommentReply

func (m *MockClient) CreateReviewCommentReply(owner, repo string, commentID int, body string) (*Comment, error)

func (*MockClient) FindReviewThreadForComment

func (m *MockClient) FindReviewThreadForComment(owner, repo string, prNumber, commentID int) (string, error)

func (*MockClient) ListIssueComments

func (m *MockClient) ListIssueComments(owner, repo string, prNumber int) ([]Comment, error)

Mock implementations

func (*MockClient) ListReviewComments

func (m *MockClient) ListReviewComments(owner, repo string, prNumber int) ([]Comment, error)

func (*MockClient) ResolveReviewThread

func (m *MockClient) ResolveReviewThread(threadID string) error

type User

type User struct {
	Login     string `json:"login"`
	ID        int    `json:"id"`
	AvatarURL string `json:"avatar_url"`
}

User represents a GitHub user

Jump to

Keyboard shortcuts

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