QtRestClient  3.0.0
A library for generic JSON-based REST-APIs, with a mechanism to map JSON to Qt objects
Public Member Functions | List of all members
QtRestClient::Simple< T, std::enable_if_t< std::is_void_v< typename T::QtGadgetHelper > > > Class Template Referenceabstract

A base class to create a simply type version for a normal one. Q_GADGET version. More...

#include <simple.h>

Public Member Functions

 Simple ()
 Constructor.
 
virtual QUrl extensionHref () const =0
 Returns the link to the extended version of this object. More...
 
bool hasExtension () const
 Returns true, if the object has an extension.
 
bool isExtended () const
 Returns true, if the object has already been extended.
 
currentExtended () const
 Returns the current extension. More...
 
template<typename ET = QObject*>
GenericRestReply< T, ET > * extend (RestClient *client)
 Performs an extension request and returns the reply to the request. More...
 
template<typename ET = QObject*>
void extend (RestClient *client, std::function< void(T, bool)> extensionHandler, const std::function< void(QString, int, RestReply::Error)> &errorHandler={}, std::function< QString(ET, int)> failureTransformer={})
 Extends the object by using a handler. More...
 
template<typename ET = QObject*>
void extend (RestClient *client, QObject *scope, std::function< void(T, bool)> extensionHandler, const std::function< void(QString, int, RestReply::Error)> &errorHandler={}, std::function< QString(ET, int)> failureTransformer={})
 Extends the object by using a handler. More...
 

Detailed Description

template<typename T>
class QtRestClient::Simple< T, std::enable_if_t< std::is_void_v< typename T::QtGadgetHelper > > >

A base class to create a simply type version for a normal one. Q_GADGET version.

Definition at line 89 of file simple.h.

Member Function Documentation

◆ currentExtended()

template<typename T >
T QtRestClient::Simple< T, std::enable_if_t< std::is_void_v< typename T::QtGadgetHelper > > >::currentExtended ( ) const

Returns the current extension.

Returns
The current extension, a default constructed value, if not extended

You will have to extend the object, before you can use this

Definition at line 266 of file simple.h.

◆ extend() [1/3]

template<typename T >
template<typename ET >
GenericRestReply< T, ET > * QtRestClient::Simple< T, std::enable_if_t< std::is_void_v< typename T::QtGadgetHelper > > >::extend ( RestClient client)

Performs an extension request and returns the reply to the request.

Parameters
clientThe rest client to be used to create the network request
Returns
The reply, or nullptr if no extension exists

Definition at line 276 of file simple.h.

◆ extend() [2/3]

template<typename T >
template<typename ET >
void QtRestClient::Simple< T, std::enable_if_t< std::is_void_v< typename T::QtGadgetHelper > > >::extend ( RestClient client,
QObject scope,
std::function< void(T, bool)>  extensionHandler,
const std::function< void(QString, int, RestReply::Error)> &  errorHandler = {},
std::function< QString(ET, int)>  failureTransformer = {} 
)

Extends the object by using a handler.

Parameters
clientThe rest client to be used to create the network request
scope(optional) A scope to limit the callback to
extensionHandlerThe handler to be called with the extended object
errorHandlerWill be passed to GenericRestReply::onAllErrors
failureTransformerWill be passed to GenericRestReply::onAllErrors

If the object is already extended it will simply be passed to the handler. If not, an internal extension is performed, and the handler called for the result.

The handlers parameters are:

  • The deserialized extended object (T)
  • The information, whether the object was extended by sending a request (true) or already available (false) (bool)

Definition at line 309 of file simple.h.

◆ extend() [3/3]

template<typename T >
template<typename ET >
void QtRestClient::Simple< T, std::enable_if_t< std::is_void_v< typename T::QtGadgetHelper > > >::extend ( RestClient client,
std::function< void(T, bool)>  extensionHandler,
const std::function< void(QString, int, RestReply::Error)> &  errorHandler = {},
std::function< QString(ET, int)>  failureTransformer = {} 
)

Extends the object by using a handler.

Parameters
clientThe rest client to be used to create the network request
extensionHandlerThe handler to be called with the extended object
errorHandlerWill be passed to GenericRestReply::onAllErrors
failureTransformerWill be passed to GenericRestReply::onAllErrors

If the object is already extended it will simply be passed to the handler. If not, an internal extension is performed, and the handler called for the result.

The handlers parameters are:

  • The deserialized extended object (T)
  • The information, whether the object was extended by sending a request (true) or already available (false) (bool)

Definition at line 291 of file simple.h.

◆ extensionHref()

template<typename T >
virtual QUrl QtRestClient::Simple< T, std::enable_if_t< std::is_void_v< typename T::QtGadgetHelper > > >::extensionHref ( ) const
pure virtual

Returns the link to the extended version of this object.

See also
QTRESTCLIENT_EXT_HREF_PROP

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