Skip to content

Commit 1a6d584

Browse files
committed
implement #113, and create new structure needed for #107
1 parent 6cff64c commit 1a6d584

File tree

93 files changed

+478
-339
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

93 files changed

+478
-339
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import URI
2+
3+
extension Swiftinit
4+
{
5+
@frozen public
6+
enum API
7+
{
8+
}
9+
}
10+
extension Swiftinit.API
11+
{
12+
@inlinable public static
13+
subscript(get:Get) -> URI { Swiftinit.Root.api / "\(get)" }
14+
15+
@inlinable public static
16+
subscript(post:Post) -> URI { Swiftinit.Root.api / "\(post)" }
17+
18+
@inlinable public static
19+
subscript(put:Put) -> URI { Swiftinit.Root.api / "\(put)" }
20+
}

Sources/Swiftinit/Assets/Swiftinit.Asset.swift

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,6 @@ extension Swiftinit
2828
case admin_css_map = "admin.css.map"
2929
}
3030
}
31-
extension Swiftinit.Asset:Swiftinit.StaticRoot
32-
{
33-
@inlinable public static
34-
var root:String { "asset" }
35-
}
3631
extension Swiftinit.Asset:CustomStringConvertible
3732
{
3833
@inlinable public
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
import URI
2+
3+
extension Swiftinit
4+
{
5+
@frozen public
6+
enum Root
7+
{
8+
case admin
9+
case api
10+
case asset
11+
case blog
12+
case docs
13+
case hist
14+
case login
15+
case lunr
16+
case plugin
17+
case realm
18+
case stats
19+
case tags
20+
case telescope
21+
}
22+
}
23+
extension Swiftinit.Root
24+
{
25+
@inlinable public static
26+
func / (self:consuming Self, next:consuming String) -> URI
27+
{
28+
var uri:URI = self.uri
29+
30+
uri.path.append(next)
31+
32+
return uri
33+
}
34+
}
35+
extension Swiftinit.Root:CustomStringConvertible
36+
{
37+
@inlinable public
38+
var description:String { "/\(self.id)" }
39+
}
40+
extension Swiftinit.Root:Identifiable
41+
{
42+
@inlinable public
43+
var id:String
44+
{
45+
switch self
46+
{
47+
case .admin: "admin"
48+
case .api: "api"
49+
case .asset: "asset"
50+
case .blog: "articles"
51+
case .docs: "docs"
52+
case .hist: "hist"
53+
case .login: "login"
54+
case .lunr: "lunr"
55+
case .plugin: "plugin"
56+
case .realm: "realm"
57+
case .stats: "stats"
58+
case .tags: "tags"
59+
case .telescope: "telescope"
60+
}
61+
}
62+
}
63+
extension Swiftinit.Root
64+
{
65+
@inlinable public
66+
var uri:URI { [.push(self.id)] }
67+
}

Sources/Swiftinit/Swiftinit.StaticRoot.swift

Lines changed: 0 additions & 33 deletions
This file was deleted.

Sources/Swiftinit/Tree/Swiftinit.API.swift

Lines changed: 0 additions & 9 deletions
This file was deleted.

Sources/Swiftinit/Tree/Swiftinit.Admin.swift

Lines changed: 0 additions & 9 deletions
This file was deleted.

0 commit comments

Comments
 (0)