Download VeilFS Documentation

Transcript
VeilFS Documentation, Release 1.0
Function Index
• allowed_methods/3
• content_types_provided/2
• content_types_provided/3
• delete/3
• exists/3
• get/2
• get/3
• post/4
• put/4
• validate/4
Function Details
allowed_methods(req(), binary(), binary()) → {[binary()], req()}
Should return list of methods that are allowed and directed at specific Id. e.g.: if Id =:=
undefined -> ‘[< >, < >]’ if Id /= undefined -> ‘[< >, < >, < >]’
content_types_provided(req(), binary()) → {[binary()], req()}
Should return list of provided content-types without specified ID (e.g. ”.../rest/resource/”).
Should take into account different types of methods (PUT, GET etc.), if needed. Should return
empty list if method is not supported.
content_types_provided(req(), binary(), binary()) → {[binary()], req()}
Should return list of provided content-types with specified ID (e.g.
”.../rest/resource/some_id”). Should take into account different types of methods (PUT,
GET etc.), if needed. Should return empty list if method is not supported.
delete(req(), binary(), binary()) → {boolean(), req()}
Will be called for DELETE request on given ID. Should try to remove specified resource and
return true/false indicating the result. Should always return false if the method is not supported.
exists(req(), binary(), binary()) → {boolean(), req()}
Should return whether resource specified by given ID exists. Will be called for GET, PUT and
DELETE when ID is contained in the URL.
get(req(), binary()) → {term() | {stream, integer(), function()} | halt, req(), req()}
Will be called for GET request without specified ID (e.g. ”.../rest/resource/”). Should return
one of the following: 1. ResponseBody, of the same type as content_types_provided/1 returned for this request 2. Cowboy type stream function, serving content of the same type as
content_types_provided/1 returned for this request 3. ‘halt’ atom if method is not supported
get(req(), binary(), binary()) → {term() | {stream, integer(), function()} | halt, req(),
req()}
Will be called for GET request with specified ID (e.g. ”.../rest/resource/some_id”). Should
return one of the following: 1. ResponseBody, of the same type as content_types_provided/2
11.4. Veil modules
137