equal
deleted
inserted
replaced
15 // see RFC3339 in https://www.php.net/manual/en/class.datetimeinterface.php |
15 // see RFC3339 in https://www.php.net/manual/en/class.datetimeinterface.php |
16 val Date_Format: Date.Format = Date.Format("uuuu-MM-dd'T'HH:mm:ssxxx") |
16 val Date_Format: Date.Format = Date.Format("uuuu-MM-dd'T'HH:mm:ssxxx") |
17 |
17 |
18 def server(url: URL): Server = new Server(url) |
18 def server(url: URL): Server = new Server(url) |
19 |
19 |
20 class Server private[Flarum](url: URL) |
20 class Server private[Flarum](url: URL) extends JSON_API.Service(url) |
21 { |
21 { |
22 override def toString: String = url.toString |
22 def get_api(route: String): JSON_API.Root = |
|
23 get_root("api" + (if (route.isEmpty) "" else "/" + route)) |
23 |
24 |
24 def get(route: String): HTTP.Content = |
25 val root: JSON_API.Root = get_api("") |
25 HTTP.Client.get(if (route.isEmpty) url else new URL(url, route)) |
26 def users: JSON_API.Root = get_api("users") |
26 |
27 def groups: JSON_API.Root = get_api("groups") |
27 def get_api(route: String = ""): JSON_API.Root = |
28 def discussions: JSON_API.Root = get_api("discussions") |
28 JSON_API.Root(get("api" + (if (route.isEmpty) "" else "/" + route)).json) |
|
29 |
|
30 val root: JSON_API.Root = get_api() |
|
31 } |
29 } |
32 } |
30 } |