reviewservice

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrCommentNotFound = errors.New("review comment not found")

Functions

This section is empty.

Types

type Catalog

type Catalog struct {
	// contains filtered or unexported fields
}

func NewCatalog

func NewCatalog(provider ContextProvider, store MutationStore) *Catalog

func (*Catalog) GetDiff

func (catalog *Catalog) GetDiff(ctx context.Context, id string, scope review.DiffMode) (review.RepositoryDiff, error)

func (*Catalog) GetPatch

func (catalog *Catalog) GetPatch(ctx context.Context, id string, scope review.DiffMode, fileID string) (review.FilePatch, error)

func (*Catalog) ListContexts

func (catalog *Catalog) ListContexts(ctx context.Context, limit int, cursor string, filter ingestion.Filter) (contextservice.Page, error)

func (*Catalog) Review

func (catalog *Catalog) Review(ctx context.Context, id string) (*Service, error)

type Comment

type Comment struct {
	review.ReviewComment
	Applicability string `json:"applicability"`
	Actionable    bool   `json:"actionable"`
}

type CommentNotFoundError

type CommentNotFoundError struct {
	CommentID string
}

func (*CommentNotFoundError) Error

func (err *CommentNotFoundError) Error() string

func (*CommentNotFoundError) Unwrap

func (err *CommentNotFoundError) Unwrap() error

type CommentStore

type CommentStore interface {
	Comments(string) ([]review.ReviewComment, error)
	PutComment(string, review.ReviewComment) error
}

type ContextProvider

type ContextProvider interface {
	ListFiltered(context.Context, int, string, ingestion.Filter) (contextservice.Page, error)
	Resolve(context.Context, string) (session.Session, error)
}

ContextProvider must resolve IDs within the authenticated user's catalog. Resolve validates ownership and expiry before any review storage is accessed.

type CreateCommentInput

type CreateCommentInput struct {
	DiffID      string          `json:"diffId"`
	VersionID   string          `json:"versionId"`
	FileID      string          `json:"fileId"`
	Scope       review.DiffMode `json:"scope"`
	FileVersion string          `json:"fileVersion"`
	Target      string          `json:"target,omitempty"`
	Side        string          `json:"side"`
	Start       int             `json:"start"`
	End         int             `json:"end"`
	Body        string          `json:"body"`
}

type DeletedComments

type DeletedComments struct {
	Comments []review.ReviewComment `json:"comments"`
	Deleted  int                    `json:"deleted"`
}

type ExportCommentsInput

type ExportCommentsInput struct {
	Revision, Scope, CommentID string
	IncludeResolved            bool
}

type MutationStore

type MutationStore interface {
	CommentStore
	DeleteComment(string, string) (bool, error)
	DeleteComments(string, map[string]bool) (int, error)
	ImportComments(string, []review.ReviewComment) ([]review.ReviewComment, error)
	Marks(string, review.DiffMode) ([]review.ReviewMark, error)
	ClearMarks(string, review.DiffMode) error
	DeleteMark(string, review.DiffMode, string) error
	PutMark(string, review.ReviewMark) error
	StoredVersion(string, string, string, time.Time) (review.RepositoryDiff, error)
}

type Resolution

type Resolution struct {
	CommentID string `json:"comment_id"`
	Status    string `json:"status"`
}

type Service

type Service struct {
	// contains filtered or unexported fields
}

func New

func New(active session.Session, store MutationStore) *Service

func (*Service) ClearMarks

func (service *Service) ClearMarks(mode review.DiffMode) error

func (*Service) Comments

func (service *Service) Comments() ([]review.ReviewComment, error)

func (*Service) CreateComment

func (service *Service) CreateComment(ctx context.Context, body CreateCommentInput) (review.ReviewComment, error)

func (*Service) CurrentFile

func (service *Service) CurrentFile(ctx context.Context, mode review.DiffMode, diffID, versionID, fileID, fileVersion string) (review.RepositoryDiff, review.ChangedFile, error)

func (*Service) DeleteComment

func (service *Service) DeleteComment(id string) (bool, error)

func (*Service) DeleteComments

func (service *Service) DeleteComments(ctx context.Context, selection string) (DeletedComments, error)

func (*Service) DeleteMark

func (service *Service) DeleteMark(mode review.DiffMode, id string) error

func (*Service) ExportComments

func (service *Service) ExportComments(ctx context.Context, input ExportCommentsInput) (string, error)

func (*Service) ImportComments

func (service *Service) ImportComments(ctx context.Context, input []review.ReviewComment) ([]review.ReviewComment, error)

func (*Service) ListComments

func (service *Service) ListComments(ctx context.Context, includeResolved bool) ([]Comment, error)

func (*Service) Marks

func (service *Service) Marks(mode review.DiffMode) ([]review.ReviewMark, error)

func (*Service) PutMark

func (service *Service) PutMark(ctx context.Context, mode review.DiffMode, fileID, versionID, fileVersion string) (review.ReviewMark, error)

func (*Service) ResolveComment

func (service *Service) ResolveComment(commentID string) (Resolution, error)

func (*Service) Snapshot

func (service *Service) Snapshot(ctx context.Context, mode review.DiffMode) (review.RepositoryDiff, error)

Snapshot reads and capability checks belong to the application, shared by transports.

func (*Service) UpdateComment

func (service *Service) UpdateComment(commentID string, body UpdateCommentInput) (review.ReviewComment, error)

type UpdateCommentInput

type UpdateCommentInput struct {
	Body   *string `json:"body"`
	Status *string `json:"status"`
}

Jump to

Keyboard shortcuts

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