0 | module HTTP.API.Client.Path
2 | import HTTP.API.Client.Interface
7 | recTypes : (ps : List Part) -> TList (PartsTypes ps)
9 | recTypes (PScheme _ :: xs) = recTypes xs
10 | recTypes (PAuth _ :: xs) = recTypes xs
11 | recTypes (PStr _ :: xs) = recTypes xs
12 | recTypes (PTill _ :: xs) = recTypes xs
13 | recTypes (Capture t :: xs) = t :: recTypes xs
17 | -> All EncodeMany (PartsTypes ps)
18 | -> HList (PartsTypes ps)
21 | reqPath (PScheme _ :: ps) es vs = reqPath ps es vs
22 | reqPath (PAuth _ :: ps) es vs = reqPath ps es vs
23 | reqPath (PStr s :: ps) es vs = fromString s :: reqPath ps es vs
24 | reqPath (PTill s :: ps) es vs = fromString s :: reqPath ps es vs
25 | reqPath (Capture _ :: ps) (e::es) (v::vs) = encodeMany v ++ reqPath ps es vs
27 | adjAuth : List Part -> HTTPRequest -> HTTPRequest
29 | adjAuth (PAuth s :: _) r = adjURI {authority := Just $
cast s} r
30 | adjAuth (_ :: xs) r = adjAuth xs r
32 | adjScheme : List Part -> HTTPRequest -> HTTPRequest
34 | adjScheme (PScheme s :: _) r = adjURI {scheme := Just $
cast s} r
35 | adjScheme (_ :: xs) r = adjScheme xs r
38 | Receive ReqPath where
39 | RecConstraint p = All EncodeMany (PartsTypes p.parts)
40 | RecTypes p = PartsTypes p.parts
41 | recs p = recTypes p.parts
42 | adjRequest (Path ps) vs r =
43 | let pth := reqPath ps con vs
44 | in adjURI {path := pth} . adjScheme ps $
adjAuth ps r
47 | GetResponse ReqPath where
48 | RespEncodings _ = []