NewReviewComment

com.worxbend.codeberg4s.pulls.NewReviewComment
See theNewReviewComment companion object
final case class NewReviewComment(body: String, path: String, newPosition: Option[Long], oldPosition: Option[Long], extraLinesCount: Option[Long])

One inline remark to write, as CreatePullReviewComment expects it.

Used twice: on its own as the body of POST /repos/{owner}/{repo}/pulls/{index}/reviews/{id}/comments, and as an element of CreateReview.comments when a whole review is posted in one call. The pinned spec expresses that reuse literally — CreatePullReviewCommentOptions is a $ref to CreatePullReviewComment and nothing else — so this library models it once.

==Which line, and which side of the diff==

Forgejo carries two line numbers and uses 0 for "not this side": new_position addresses the line as it appears '''after''' the change, old_position addresses it as it appeared '''before'''. Getting them the wrong way round anchors the remark to an unrelated line rather than failing, which is why there is no constructor taking both. Pick the one that says what is meant:

for remark <- NewReviewComment.onNewLine("modules/git/hook.go", 42L, "this quoting is still wrong")
yield remark.spanning(3L)

NewReviewComment.onFile is the third possibility — a remark about the file as a whole, with neither position set — which Forgejo accepts and renders at the top of the file's diff.

Value parameters

body

the remark, as Markdown source; trimmed and required by every constructor

extraLinesCount

how many further lines the remark covers, absent for a single-line remark. Forgejo reads an absent value and a 0 identically, so this library sends neither unless spanning was called

newPosition

the line on the new side of the diff, absent for a remark on the old side or on the file as a whole

oldPosition

the line on the old side of the diff, absent for a remark on the new side or on the file as a whole

path

the file the remark is about, relative to the repository root, exactly as com.worxbend.codeberg4s.pulls.ChangedFile.filename reports it

Attributes

Companion
object
Graph
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Members list

Value members

Concrete methods

def spanning(lines: Long): NewReviewComment

Extends the remark over lines further lines after the one it is anchored to.

Extends the remark over lines further lines after the one it is anchored to.

A non-positive lines leaves the remark single-line rather than failing: 0 is what Forgejo already means by an absent extra_lines_count, and a negative span has no reading at all.

Attributes

Inherited methods

def productElementNames: Iterator[String]

An iterator over the names of all the elements of this product.

An iterator over the names of all the elements of this product.

Attributes

Inherited from:
Product
def productIterator: Iterator[Any]

An iterator over all the elements of this product.

An iterator over all the elements of this product.

Attributes

Returns

in the default implementation, an Iterator[Any]

Inherited from:
Product