MarkupOptionDto

com.worxbend.codeberg4s.miscellaneous.wire.MarkupOptionDto
See theMarkupOptionDto companion object
final case class MarkupOptionDto(text: String, mode: String, context: Option[String], filePath: Option[String], branchPath: Option[String], wiki: Boolean)

Forgejo's MarkupOption model — the '''request''' body of POST /markup.

Written rather than read, so the same two conventions read backwards here as in MarkdownOptionDto: no Reader, no toDomain, and instead a fromDomain that narrows a domain request into the wire shape and a toJson that renders it. Rule 4 of com.worxbend.codeberg4s.codec.WireConventions still holds — each wire name is spelled exactly once, in toJson.

'''The field names are capitalised, and that is not a typo''' — MarkupOption carries no JSON tags either, so Go's marshaller uses the field names verbatim. See MarkdownOptionDto for the full argument; this model adds FilePath and BranchPath to the four that model shares.

'''Derived from spec/swagger.v1.json's MarkupOption definition.''' golden/MANIFEST.md records that the markdown endpoints answered 401 anonymously on codeberg.org, so neither renderer has a captured request or response.

Value parameters

branchPath

the branch relative links resolve against, omitted when absent

context

the repository references resolve against, omitted from the body entirely when absent

filePath

the file name file mode dispatches on, omitted when absent

mode

the lowercase mode token, from com.worxbend.codeberg4s.miscellaneous.MarkupMode.wireName

text

the markup source

wiki

whether the document is a wiki page

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 toJson: String

Renders the body Forgejo expects, with the three optional keys present only when the caller supplied them.

Renders the body Forgejo expects, with the three optional keys present only when the caller supplied them.

Cannot fail: every field is already a plain JSON value, and the JSON parser escapes the strings — which is why com.worxbend.codeberg4s.miscellaneous.MarkupRenderRequest does not validate the two paths.

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