vibe.web.common
Contains common functionality for the REST and WEB interface generators.
Copyright
Types 15
Respresents a Rest error response
Json m_jsonResultinout(Json) jsonResult() @property inout nothrow pure @safe @nogcThe result text reported to the clientprivate
string dataprivate
HTTPMethod dataUDA for using a custom serializer for the method return value.
Instead of using the default serializer (JSON), this allows to define custom serializers. Multiple serializers can be specified and will be matched against the Accept header of the HTTP request.
Parameters
serialize | An alias to a generic function taking an output range as its first argument and the value to be serialized as its second argument. The result of the serialization is written byte-wise into the output range. |
deserialize | An alias to a generic function taking a forward range as its first argument and a reference to the value that is to be deserialized. |
content_type | The MIME type of the serialized representation. |
private
ContentType contentTypeThis struct contains the name of a route specified by the path function.
string dataThe specified pathprivate
This struct contains a mapping between the name used by HTTP (field) and the parameter (identifier) name of the function.
ParameterKind originThe type of the WebParamAttributestring identifierParameter name (function parameter name).string fieldThe meaning of this field depends on the origin. (HTTP request name)Determines the naming convention of an identifier.
Speficies how D fields are mapped to form field names
string fieldstring textFunctions 23
string adjustMethodStyle(string name, MethodStyle style) @safeAdjusts the naming convention for a given function name to the specified style.auto extractHTTPMethodAndName(alias Func, bool indexSpecialCase)()Determines the HTTP method and path for a given function symbol.ContentTypeAttribute contentType(string data) @safeAttribute to define the content type for methods.MethodAttribute method(HTTPMethod data) @safeAttribute to force a specific HTTP method for an interface method.PathAttribute rootPathFromName() @property @safeConvenience alias to generate a name from the interface's name.NoRouteAttribute noRoute() @propertyMethods marked with this attribute will not be treated as web endpoints.void defaultSerialize(alias P, T, RT)(ref RT output_range, const scope ref T value)T defaultDeserialize(alias P, T, R)(R input_range)WebParamAttribute viaBody(string field = null) @safeDeclare that a parameter will be transmitted to the API through the body.WebParamAttribute viaHeader(string field) @safeDeclare that a parameter will be transmitted to the API through the headers.WebParamAttribute viaQuery(string field) @safeDeclare that a parameter will be transmitted to the API through the query string.ParamResult processFormParam(T)(scope string data, string fieldname, ref T dst, ref ParamError err)ParamResult readFormParamRec(T)(scope HTTPServerRequest req, ref T dst, string fieldname, bool required, NestedNameStyle style, ref ParamError err)Variables 2
viaStatus = WebParamAttribute(ParameterKind.status)Declares a parameter to be transmitted via the HTTP status code or phrase.
This attribute can be applied to one or two out parameters of type HTTPStatus/int or string. The values of those parameters correspond to the HTTP status code or phrase, depending on the type.
MAX_ARR_INDEX = 0xffffTemplates 3
Convenience template to get all the ResultSerializers for a function
private