src/Pure/Tools/flarum.scala
author Fabian Huch <huch@in.tum.de>
Tue, 04 Jun 2024 18:24:38 +0200
changeset 80249 58881e1e4a75
parent 79510 d8330439823a
permissions -rw-r--r--
web app: proper document height;

/*  Title:      Pure/Tools/flarum.scala
    Author:     Makarius

Support for Flarum forum server: https://flarum.org
*/

package isabelle


object Flarum {
  // see RFC3339 in https://www.php.net/manual/en/class.datetimeinterface.php
  val Date_Format: Date.Format = Date.Format("uuuu-MM-dd'T'HH:mm:ssxxx")

  def server(url: Url): Server = new Server(url)

  class Server private[Flarum](url: Url) extends JSON_API.Service(url) {
    def get_api(route: String): JSON_API.Root = get_root(Url.append_path("api", route))
    val root: JSON_API.Root = get_api("")
    def users: JSON_API.Root = get_api("users")
    def groups: JSON_API.Root = get_api("groups")
    def discussions: JSON_API.Root = get_api("discussions")
  }
}