Fawkes API  Fawkes Development Version
PluginOpResponse Class Reference

PluginOpResponse representation for JSON transfer. More...

#include <PluginOpResponse.h>

Public Member Functions

 PluginOpResponse ()
 Constructor. More...
 
 PluginOpResponse (const std::string &json)
 Constructor from JSON. More...
 
 PluginOpResponse (const rapidjson::Value &v)
 Constructor from JSON. More...
 
virtual ~PluginOpResponse ()
 Destructor. More...
 
virtual std::string to_json (bool pretty=false) const
 Render object to JSON. More...
 
virtual void to_json_value (rapidjson::Document &d, rapidjson::Value &v) const
 Render object to JSON. More...
 
virtual void from_json (const std::string &json)
 Retrieve data from JSON string. More...
 
virtual void from_json_value (const rapidjson::Value &v)
 Retrieve data from JSON string. More...
 
virtual void validate (bool subcall=false) const
 Validate if all required fields have been set. More...
 
std::optional< std::string > kind () const
 Get kind value. More...
 
void set_kind (const std::string &kind)
 Set kind value. More...
 
std::optional< std::string > apiVersion () const
 Get apiVersion value. More...
 
void set_apiVersion (const std::string &apiVersion)
 Set apiVersion value. More...
 
std::optional< std::string > name () const
 Get name value. More...
 
void set_name (const std::string &name)
 Set name value. More...
 
std::optional< std::string > state () const
 Get state value. More...
 
void set_state (const std::string &state)
 Set state value. More...
 
std::optional< std::string > message () const
 Get message value. More...
 
void set_message (const std::string &message)
 Set message value. More...
 

Static Public Member Functions

static std::string api_version ()
 Get version of implemented API. More...
 

Detailed Description

PluginOpResponse representation for JSON transfer.

Definition at line 26 of file PluginOpResponse.h.

Constructor & Destructor Documentation

◆ PluginOpResponse() [1/3]

PluginOpResponse::PluginOpResponse ( )

Constructor.

Definition at line 23 of file PluginOpResponse.cpp.

◆ PluginOpResponse() [2/3]

PluginOpResponse::PluginOpResponse ( const std::string &  json)

Constructor from JSON.

Parameters
jsonJSON string to initialize from

Definition at line 27 of file PluginOpResponse.cpp.

References from_json().

◆ PluginOpResponse() [3/3]

PluginOpResponse::PluginOpResponse ( const rapidjson::Value &  v)

Constructor from JSON.

Parameters
vRapidJSON value object to initialize from.

Definition at line 32 of file PluginOpResponse.cpp.

References from_json_value().

◆ ~PluginOpResponse()

PluginOpResponse::~PluginOpResponse ( )
virtual

Destructor.

Definition at line 37 of file PluginOpResponse.cpp.

Member Function Documentation

◆ api_version()

static std::string PluginOpResponse::api_version ( )
inlinestatic

Get version of implemented API.

Returns
string representation of version

Definition at line 48 of file PluginOpResponse.h.

◆ apiVersion()

std::optional<std::string> PluginOpResponse::apiVersion ( ) const
inline

Get apiVersion value.

Returns
apiVersion value

Definition at line 109 of file PluginOpResponse.h.

Referenced by set_apiVersion().

◆ from_json()

void PluginOpResponse::from_json ( const std::string &  json)
virtual

Retrieve data from JSON string.

Parameters
jsonJSON representation suitable for this object. Will allow partial assignment and not validate automaticaly.
See also
validate()

Definition at line 96 of file PluginOpResponse.cpp.

References from_json_value().

Referenced by PluginOpResponse().

◆ from_json_value()

void PluginOpResponse::from_json_value ( const rapidjson::Value &  v)
virtual

Retrieve data from JSON string.

Parameters
vRapidJSON value suitable for this object. Will allow partial assignment and not validate automaticaly.
See also
validate()

Definition at line 105 of file PluginOpResponse.cpp.

Referenced by from_json(), and PluginOpResponse().

◆ kind()

std::optional<std::string> PluginOpResponse::kind ( ) const
inline

Get kind value.

Returns
kind value

Definition at line 92 of file PluginOpResponse.h.

Referenced by set_kind().

◆ message()

std::optional<std::string> PluginOpResponse::message ( ) const
inline

Get message value.

Returns
message value

Definition at line 160 of file PluginOpResponse.h.

Referenced by set_message().

◆ name()

std::optional<std::string> PluginOpResponse::name ( ) const
inline

Get name value.

Returns
name value

Definition at line 126 of file PluginOpResponse.h.

Referenced by set_name().

◆ set_apiVersion()

void PluginOpResponse::set_apiVersion ( const std::string &  apiVersion)
inline

Set apiVersion value.

Parameters
apiVersionnew value

Definition at line 118 of file PluginOpResponse.h.

References apiVersion().

◆ set_kind()

void PluginOpResponse::set_kind ( const std::string &  kind)
inline

Set kind value.

Parameters
kindnew value

Definition at line 101 of file PluginOpResponse.h.

References kind().

◆ set_message()

void PluginOpResponse::set_message ( const std::string &  message)
inline

Set message value.

Parameters
messagenew value

Definition at line 169 of file PluginOpResponse.h.

References message().

◆ set_name()

void PluginOpResponse::set_name ( const std::string &  name)
inline

Set name value.

Parameters
namenew value

Definition at line 135 of file PluginOpResponse.h.

References name().

◆ set_state()

void PluginOpResponse::set_state ( const std::string &  state)
inline

Set state value.

Parameters
statenew value

Definition at line 152 of file PluginOpResponse.h.

References state().

◆ state()

std::optional<std::string> PluginOpResponse::state ( ) const
inline

Get state value.

Returns
state value

Definition at line 143 of file PluginOpResponse.h.

Referenced by set_state().

◆ to_json()

std::string PluginOpResponse::to_json ( bool  pretty = false) const
virtual

Render object to JSON.

Parameters
prettytrue to enable pretty printing (readable spacing)
Returns
JSON string

Definition at line 42 of file PluginOpResponse.cpp.

References to_json_value().

◆ to_json_value()

void PluginOpResponse::to_json_value ( rapidjson::Document &  d,
rapidjson::Value &  v 
) const
virtual

Render object to JSON.

Parameters
dRapidJSON document to retrieve allocator from
vRapidJSON value to add data to

Definition at line 61 of file PluginOpResponse.cpp.

Referenced by to_json().

◆ validate()

void PluginOpResponse::validate ( bool  subcall = false) const
virtual

Validate if all required fields have been set.

Parameters
subcalltrue if this is called from another class, e.g., a sub-class or array holder. Will modify the kind of exception thrown.
Exceptions
std::vector<std::string>thrown if required information is missing and subcall is set to true. Contains a list of missing fields.
std::runtime_errorinformative message describing the missing fields

Definition at line 125 of file PluginOpResponse.cpp.


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