vibe.d beta banner
get vibe.d
0.10.1

Asynchronous I/O that doesn’t get in your way, written in D

Function viaQuery

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

WebParamAttribute viaQuery (
  string field
) @safe;

It will be serialized as part of a JSON object, and will go through URL serialization. The serialization format is not customizable.

There are currently two kinds of symbol to do this: viaQuery and queryParam. viaQuery should be applied to the parameter itself, while queryParam is applied to the function. queryParam was introduced long before the D language for UDAs on parameters (introduced in DMD v2.082.0), and will be deprecated in a future release.

Parameters

NameDescription
identifier The name of the parameter to customize. A compiler error will be issued on mismatch.
field The field name to use. ---- // For a call to postData("D is awesome"), the server will receive the query: // POST /data?test=%22D is awesome%22 void postData(@viaQuery("test") string data); ----
Authors

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

Copyright

© 2012-2017 Sönke Ludwig

License

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