sig
module Types :
sig
type mode = Http | Cgi
type error = User | Server | Unauth
exception User_exn of string
exception Server_exn of string
exception Unauth_exn of string
end
val error :
?error:Restful.Types.error -> ('a, unit, string, 'b) Stdlib.format4 -> 'a
module Convert :
sig
val boolean : string -> bool
val int : string -> int
val int64 : string -> Stdlib.Int64.t
val float : string -> float
end
module Param :
sig
type mandopt = Mandatory | Optional
type spec = string * Restful.Param.mandopt * (string -> bool)
type specs = Restful.Param.spec list
type vparms
val process :
?strict:bool ->
Netcgi.cgi -> Restful.Param.specs -> Restful.Param.vparms
val value : ?default:string -> Restful.Param.vparms -> string -> string
val optvalue : Restful.Param.vparms -> string -> string option
val get :
Netcgi.cgi ->
Restful.Param.mandopt -> (string -> bool) -> string -> string option
val at_least_one :
string list -> Restful.Param.vparms -> Restful.Param.vparms
val mutex :
?atleast:bool ->
string list ->
string list -> Restful.Param.vparms -> Restful.Param.vparms
end
module Valid :
sig
val notnull : string -> bool
val notblank : string -> bool
val noblanks : string -> bool
val boolean : string -> bool
val numeric : string -> bool
val nonzero : string -> bool
val positive : string -> bool
val atleast : int -> string -> bool
val atmost : int -> string -> bool
val even : string -> bool
val odd : string -> bool
val url : ?syntax:Neturl.url_syntax -> string -> bool
val list_member : 'a list -> 'a -> bool
val no_dot_dot : string -> bool
val relative : string -> bool
val subdir_of : ?dotok:bool -> string -> string -> bool
val subtree_of : string -> string -> bool
val javascript_identifier : string -> bool
val in_map : 'a Kwrefer.SM.t -> Kwrefer.SM.key -> bool
val conjunction : ('a -> bool) list -> 'a -> bool
val disjunction : ('a -> bool) list -> 'a -> bool
end
module Encode :
sig
val html :
?in_enc:Netconversion.encoding ->
?out_enc:Netconversion.encoding -> string -> string
end
module Url :
sig
type t
val me :
?qs:(string * string) list ->
?pi:string list -> Netcgi.cgi -> Restful.Url.t
val to_string : Restful.Url.t -> string
module P :
sig
val zap : Restful.Url.t -> Restful.Url.t
val replace : string list -> Restful.Url.t -> Restful.Url.t
end
module Q :
sig
val zap : Restful.Url.t -> Restful.Url.t
val replace : string -> string -> Restful.Url.t -> Restful.Url.t
val add : string -> string -> Restful.Url.t -> Restful.Url.t
val delete : string -> Restful.Url.t -> Restful.Url.t
end
end
module Pathinfo :
sig
type subservice =
Netcgi.cgi -> string -> string list -> Nethttp.http_status
val dispatch :
?def:Restful.Pathinfo.subservice ->
string ->
(string * Restful.Pathinfo.subservice) list ->
Netcgi.cgi -> Nethttp.http_status
end
module Json :
sig
type json =
String of string
| Num of int
| Float of float
| Bool of bool
| Null
| Array of Restful.Json.json list
| Object of (string * Restful.Json.json) list
val string : string -> Restful.Json.json
val num : int -> Restful.Json.json
val float : float -> Restful.Json.json
val bool : bool -> Restful.Json.json
val null : 'a -> Restful.Json.json
val array : ('a -> Restful.Json.json) -> 'a list -> Restful.Json.json
val obj :
('a -> Restful.Json.json) -> (string * 'a) list -> Restful.Json.json
val of_option :
('a -> Restful.Json.json) -> 'a option -> Restful.Json.json
val to_string : ?minify:bool -> Restful.Json.json -> string
val callback : ?minify:bool -> string -> Restful.Json.json -> string
val valid_id : string -> bool
val content_type : string
val json_of_jsonm :
([< `A of 'a list
| `Bool of bool
| `Float of float
| `Null
| `O of (string * 'a) list
| `String of string ]
as 'a) ->
Restful.Json.json
end
module Content :
sig
val redirect :
?msg:string ->
?status:Nethttp.http_status ->
Netcgi.cgi -> string -> Nethttp.http_status
val write :
?status:Nethttp.http_status ->
?content_type:string -> Netcgi.cgi -> string -> Nethttp.http_status
end
module Robots :
sig
type user_agent = User_agent of string
type disallow = Disallow of string
type record =
Restful.Robots.user_agent * Restful.Robots.disallow *
Restful.Robots.disallow list
val all :
('a -> 'b -> Netcgi.cgi -> Nethttp.http_status) ->
'a -> 'b -> Netcgi.cgi -> Nethttp.http_status
val none :
('a -> 'b -> Netcgi.cgi -> Nethttp.http_status) ->
'a -> 'b -> Netcgi.cgi -> Nethttp.http_status
val some :
?text:string ->
?file:string ->
?robots:(Restful.Robots.user_agent * Restful.Robots.disallow *
Restful.Robots.disallow list)
list ->
('a -> 'b -> Netcgi.cgi -> Nethttp.http_status) ->
'a -> 'b -> Netcgi.cgi -> Nethttp.http_status
end
module Favicon :
sig
val ico : string
val content_type : string
val favicon :
?file:string ->
?data:string ->
('a -> 'b -> Netcgi.cgi -> Nethttp.http_status) ->
'a -> 'b -> Netcgi.cgi -> Nethttp.http_status
end
module Config :
sig
type init = Good of Kwrefer.refermap Kwrefer.SM.t | Bad of string
val load :
?validate:(?loc:string ->
Kwrefer.SS.t Kwrefer.SM.t * Kwrefer.validation_error list ->
int ->
(Kwrefer.SM.key * Kwrefer.SS.elt) list ->
Kwrefer.SS.t Kwrefer.SM.t * Kwrefer.validation_error list) ->
string -> string -> Restful.Config.init
val loadenv :
?validate:(?loc:string ->
Kwrefer.SS.t Kwrefer.SM.t * Kwrefer.validation_error list ->
int ->
(Kwrefer.SM.key * Kwrefer.SS.elt) list ->
Kwrefer.SS.t Kwrefer.SM.t * Kwrefer.validation_error list) ->
string -> string -> Restful.Config.init
val dump :
string list Kwrefer.SM.t Kwrefer.SM.t ->
(Kwrefer.SM.key * string) list list
end
module Auth :
sig
type scheme = Basic | Digest
module Cred :
sig
type result = Okay of (string * string) | Bogus of string
val basic :
Restful.Auth.scheme -> string -> Restful.Auth.Cred.result
val digest : 'a -> 'b -> 'c
end
module Valid :
sig
val given :
user:string -> pass:string -> Restful.Auth.Cred.result -> bool
end
val basic :
validate:(Restful.Auth.Cred.result -> bool) ->
realm:string ->
('a -> 'b -> Netcgi.cgi -> Nethttp.http_status) ->
'a -> 'b -> Netcgi.cgi -> Nethttp.http_status
end
module type SERVICE =
sig
type data
val version : (string * string) list
val init : string list -> Restful.SERVICE.data
val main :
Restful.Types.mode ->
Restful.SERVICE.data -> Netcgi.cgi -> Nethttp.http_status
end
module Service :
sig
type data = unit
val version : (string * string) list
val init : string list -> data
val main : Types.mode -> data -> Netcgi.cgi -> Nethttp.http_status
end
module type LOG =
sig
type data
val init : string list -> Restful.LOG.data
val handler :
Restful.LOG.data ->
Restful.Types.mode -> Netcgi.cgi -> Nethttp.http_status -> unit
val error : ('a, unit, string, unit) Stdlib.format4 -> 'a
end
module Log :
sig
val clf_format :
?ident:string ->
?authuser:string ->
?time:float ->
?bytes:int ->
?host:string ->
?request:string -> Nethttp.http_status -> Netcgi.cgi -> string
module Default : LOG
module Null : LOG
module Year_month : LOG
end
module type ERROR =
sig
type data
val loginit : string list -> Restful.ERROR.data
val handler :
Restful.ERROR.data ->
Restful.Types.mode ->
(Netcgi.cgi -> Nethttp.http_status) -> Netcgi.cgi -> unit
end
module Error : functor (Log : LOG) -> ERROR
module Make :
functor (Service : SERVICE) (Error : ERROR) ->
sig val main : ?argv:string array -> unit -> unit end
end