Fawkes API  Fawkes Development Version
fawkes::WebviewRestParams Class Reference

REST parameters to pass to handlers. More...

#include <rest_api.h>

Public Member Functions

 WebviewRestParams ()
 Constructor. More...
 
std::string path_arg (const std::string &what)
 Get a path argument. More...
 
std::string query_arg (const std::string &what)
 Get a query argument. More...
 
bool has_query_arg (const std::string &what)
 Check if query argument is set. More...
 
bool pretty_json ()
 Is pretty-printed JSON enabled? More...
 
void set_pretty_json (bool pretty)
 Enable or disable pretty printed results. More...
 

Friends

class WebviewRestApi
 REST API can call private methods. More...
 

Detailed Description

REST parameters to pass to handlers.

Author
Tim Niemueller

Definition at line 124 of file rest_api.h.

Constructor & Destructor Documentation

◆ WebviewRestParams()

fawkes::WebviewRestParams::WebviewRestParams ( )
inline

Constructor.

Definition at line 131 of file rest_api.h.

Member Function Documentation

◆ has_query_arg()

bool fawkes::WebviewRestParams::has_query_arg ( const std::string &  what)
inline

Check if query argument is set.

Retrieves a named query argument that was passed in the URL, e.g., retrieve "pretty" for "?pretty".

Parameters
whatwhat to check
Returns
true if the argument exists (with any value), false otherwise

Definition at line 174 of file rest_api.h.

Referenced by fawkes::WebviewRestApi::add_handler().

◆ path_arg()

std::string fawkes::WebviewRestParams::path_arg ( const std::string &  what)
inline

Get a path argument.

Retrieves a named argument that was a token in the registration URL, e.g., retrieve "id" for "/item/{id}".

Parameters
whatwhat to retrieve
Returns
item passed in URL or empty string

Definition at line 142 of file rest_api.h.

◆ pretty_json()

bool fawkes::WebviewRestParams::pretty_json ( )
inline

Is pretty-printed JSON enabled?

Returns
true true to request enabling pretty mode

Definition at line 183 of file rest_api.h.

Referenced by fawkes::WebviewRestApi::add_handler().

◆ query_arg()

std::string fawkes::WebviewRestParams::query_arg ( const std::string &  what)
inline

Get a query argument.

Retrieves a named query argument that was passed in the URL, e.g., retrieve "pretty" for "?pretty=true".

Parameters
whatwhat to retrieve
Returns
item passed in URL or empty string

Definition at line 158 of file rest_api.h.

◆ set_pretty_json()

void fawkes::WebviewRestParams::set_pretty_json ( bool  pretty)
inline

Enable or disable pretty printed results.

Note that this only works when using the generated API interface and classes which support the "pretty" flag.

Parameters
prettytrue to enable, false to disable

Definition at line 194 of file rest_api.h.

Referenced by fawkes::WebviewRestApi::add_handler().

Friends And Related Function Documentation

◆ WebviewRestApi

friend class WebviewRestApi
friend

REST API can call private methods.

Definition at line 127 of file rest_api.h.


The documentation for this class was generated from the following file: