vibe.web.common

Contains common functionality for the REST and WEB interface generators.

Members

Aliases

DefaultSerializerT
alias DefaultSerializerT = ResultSerializer!(defaultSerialize, defaultDeserialize, "application/json; charset=UTF-8")
Undocumented in source.
resultSerializer
alias resultSerializer(alias serialize, alias deserialize, string content_type) = ResultSerializer!(serialize, deserialize, content_type)

UDA for using a custom serializer for the method return value.

serializationPolicy
alias serializationPolicy(Args...) = SerPolicy!(Args)

Classes

RestException
class RestException

Respresents a Rest error response

Enums

MethodStyle
enum MethodStyle

Determines the naming convention of an identifier.

NestedNameStyle
enum NestedNameStyle

Speficies how D fields are mapped to form field names

ParamResult
enum ParamResult
Undocumented in source.

Functions

adjustMethodStyle
string adjustMethodStyle(string name, MethodStyle style)

Adjusts the naming convention for a given function name to the specified style.

bodyParam
WebParamAttribute bodyParam(string identifier, string field)
WebParamAttribute bodyParam(string identifier)

Declare that a parameter will be transmitted to the API through the body.

concatURL
string concatURL(string prefix, string url, bool trailing)
Undocumented in source. Be warned that the author may not have intended to support it.
contentType
ContentTypeAttribute contentType(string data)

Attribute to define the content type for methods.

defaultDeserialize
T defaultDeserialize(R input_range)
Undocumented in source. Be warned that the author may not have intended to support it.
defaultSerialize
void defaultSerialize(RT output_range, T value)
Undocumented in source. Be warned that the author may not have intended to support it.
extractHTTPMethodAndName
auto extractHTTPMethodAndName()

Determines the HTTP method and path for a given function symbol.

headerParam
WebParamAttribute headerParam(string identifier, string field)

Declare that a parameter will be transmitted to the API through the headers.

method
MethodAttribute method(HTTPMethod data)

Attribute to force a specific HTTP method for an interface method.

path
PathAttribute path(string data)

Attibute to force a specific URL path.

queryParam
WebParamAttribute queryParam(string identifier, string field)

Declare that a parameter will be transmitted to the API through the query string.

readFormParamRec
ParamResult readFormParamRec(HTTPServerRequest req, T dst, string fieldname, bool required, NestedNameStyle style, ParamError err)
Undocumented in source. Be warned that the author may not have intended to support it.
setVoid
void setVoid(T dst, U value)
Undocumented in source. Be warned that the author may not have intended to support it.
viaBody
WebParamAttribute viaBody(string field)

Declare that a parameter will be transmitted to the API through the body.

viaHeader
WebParamAttribute viaHeader(string field)

Declare that a parameter will be transmitted to the API through the headers.

viaQuery
WebParamAttribute viaQuery(string field)

Declare that a parameter will be transmitted to the API through the query string.

webConvTo
bool webConvTo(string str, T dst, ParamError err)
Undocumented in source. Be warned that the author may not have intended to support it.

Properties

noRoute
NoRouteAttribute noRoute [@property getter]

Methods marked with this attribute will not be treated as web endpoints.

rootPathFromName
PathAttribute rootPathFromName [@property getter]

Convenience alias to generate a name from the interface's name.

Structs

ContentTypeAttribute
struct ContentTypeAttribute

private

MethodAttribute
struct MethodAttribute

private

NoRouteAttribute
struct NoRouteAttribute

private

ParamError
struct ParamError
Undocumented in source.
PathAttribute
struct PathAttribute

This struct contains the name of a route specified by the path function.

ResultSerializer
struct ResultSerializer(alias ST, alias DT, string ContentType)

private

SerPolicy
struct SerPolicy(alias PolicyTemplatePar)
WebParamAttribute
struct WebParamAttribute

This struct contains a mapping between the name used by HTTP (field) and the parameter (identifier) name of the function.

Templates

ResultSerializersT
template ResultSerializersT(alias func)

Convenience template to get all the ResultSerializers for a function

SerPolicyT
template SerPolicyT(Iface)
isNullable
template isNullable(T)

private

Meta

License

Subject to the terms of the MIT license, as written in the included LICENSE.txt file.

Authors

Sönke Ludwig, Михаил Страшун