comment

package
v1.0.61 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ReadJSON

func ReadJSON(resp *http.Response, dest interface{}) error

Types

type AuthProvider added in v1.0.46

type AuthProvider interface {
	LoadCredentials() (*auth.Credentials, error)
	ForceRefreshAccessToken() (string, error)
}

AuthProvider abstracts credential operations for testability.

type Client

type Client struct {
	BaseURL string
	AnonKey string

	HTTPClient   *http.Client
	AuthProvider AuthProvider
	Verbose      bool
	// contains filtered or unexported fields
}

func NewClient

func NewClient(accessToken string) *Client

func (*Client) CreateReply

func (c *Client) CreateReply(parentID, content string) (*ThreadReply, error)

func (*Client) DoWithRetry

func (c *Client) DoWithRetry(fn func(token string) (*http.Response, error)) (*http.Response, error)

func (*Client) FetchCommentByID

func (c *Client) FetchCommentByID(commentID string) (*ReviewComment, error)

func (*Client) FetchComments

func (c *Client) FetchComments(changeID string) ([]ReviewComment, error)

func (*Client) FetchReplies

func (c *Client) FetchReplies(changeID string) ([]ReviewComment, error)

func (*Client) FetchRepliesByParentID

func (c *Client) FetchRepliesByParentID(parentID string) ([]ReviewComment, error)

func (*Client) FetchResolvedComments

func (c *Client) FetchResolvedComments(changeID string) ([]ReviewComment, error)

func (*Client) Get

func (c *Client) Get(token, path string) (*http.Response, error)

func (*Client) GetChange

func (c *Client) GetChange(specID string) (*apiChange, error)

func (*Client) GetProject

func (c *Client) GetProject(repoOwner, repoName string) (*apiProject, error)

func (*Client) GetSpec

func (c *Client) GetSpec(projectID, specKey string) (*apiSpec, error)

func (*Client) ResolveComment

func (c *Client) ResolveComment(commentID string) error

func (*Client) ResolveCommentWithReplies

func (c *Client) ResolveCommentWithReplies(commentID string, replyIDs []string) error

func (*Client) ResolveIDPrefix added in v1.0.57

func (c *Client) ResolveIDPrefix(prefix string) (string, error)

ResolveIDPrefix resolves a short comment ID prefix to the full UUID. If the input is already a full UUID (36 chars), it is returned as-is. Returns an error if zero or multiple comments match the prefix.

type RawAPIError added in v1.0.59

type RawAPIError struct {
	StatusCode int
	Body       string
}

RawAPIError is returned when the API responds with a non-2xx status. It preserves the status code and raw body for structured formatting upstream.

func (*RawAPIError) Error added in v1.0.59

func (e *RawAPIError) Error() string

type ReplyMap

type ReplyMap map[string][]ReviewComment

func BuildReplyMap

func BuildReplyMap(replies []ReviewComment) ReplyMap

type ReviewComment

type ReviewComment struct {
	ID              string `json:"id"`
	ChangeID        string `json:"change_id"`
	FilePath        string `json:"file_path"`
	Content         string `json:"content"`
	SelectedText    string `json:"selected_text"`
	Line            *int   `json:"line"`
	StartLine       *int   `json:"start_line"`
	IsResolved      bool   `json:"is_resolved"`
	AuthorID        string `json:"author_id"`
	AuthorName      string `json:"author_name"`
	AuthorEmail     string `json:"author_email"`
	ParentCommentID string `json:"parent_comment_id"`
	CreatedAt       string `json:"created_at"`
	UpdatedAt       string `json:"updated_at"`
}

type ThreadReply

type ThreadReply struct {
	ID         string
	ParentID   string
	AuthorName string
	Content    string
	CreatedAt  string
}

Jump to

Keyboard shortcuts

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