10Duke Scale C++ Client
Loading...
Searching...
No Matches
tenduke::se::StatefulAPIRequest< R > Class Template Reference

#include <StatefulAPIRequest.h>

Detailed Description

template<class R>
class tenduke::se::StatefulAPIRequest< R >

A tenduke::se::APIRequest, which uses tenduke::oidc::OIDCSession to maintain request authorization.

This stateful request wraps the actual API-request. On execute, this request first checks if the user session is valid. If not, the session is first refreshed or login-screen is shown. The request then executes the wrapped API-request.

Exceptions are propagated to the caller. If the wrapped request fails with tenduke::se::http::Unauthorized-exception, the user session is refreshed and the wrapped request is re-executed. If the re-execution fails again with tenduke::se::http::Unauthorized, the exception is propagated to the caller.

Template Parameters
Rtype of the response
Inheritance diagram for tenduke::se::StatefulAPIRequest< R >:
tenduke::se::APIRequest< R >

Public Member Functions

 StatefulAPIRequest (const std::shared_ptr<::tenduke::se::APIRequest< R > > &request, const std::shared_ptr<::tenduke::oidc::OIDCSession > &oidc)
 Constructs new instance.
 
R execute () override
 Execute the request synchronously.
 

Constructor & Destructor Documentation

◆ StatefulAPIRequest()

template<class R >
tenduke::se::StatefulAPIRequest< R >::StatefulAPIRequest ( const std::shared_ptr<::tenduke::se::APIRequest< R > > &  request,
const std::shared_ptr<::tenduke::oidc::OIDCSession > &  oidc 
)
inline

Constructs new instance.

Parameters
requestthe wrapped request.
oidcOIDC-session.

Member Function Documentation

◆ execute()

template<class R >
R tenduke::se::StatefulAPIRequest< R >::execute ( )
inlineoverridevirtual

Execute the request synchronously.

Returns
the response.
Exceptions
tenduke::http::HTTPExceptione.g. internal server errors, invalid configuration (e.g. HTTP 404 not found) et al.
tenduke::net::NetworkingExceptione.g. timeouts, networking communication problems
tenduke::TimedOutgeneric time outs
tenduke::TendukeExceptiondepending on business logic problems (invalid json, cryptography issues, unexpected response etc.) These are usually subclasses of tenduke::TendukeException

Implements tenduke::se::APIRequest< R >.


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