# ApiController.hpp

This File On Github
Ask A Question

API: latest
module: oatpp
#include "oatpp/web/server/api/ApiController.hpp"

# ApiController

Class responsible for implementation and management of endpoints.
For details see ApiController.

namespace oatpp { namespace web { namespace server { namespace api { 
  class ApiController : public oatpp::base::Countable {}
}}}}

# Typedefs

Type Name Summary
oatpp::web::server::HttpRouter Router Convenience typedef for oatpp::web::server::HttpRouter.
oatpp::web::protocol::http::outgoing::ResponseFactory ResponseFactory Convenience typedef for oatpp::web::protocol::http::outgoing::ResponseFactory.
oatpp::web::protocol::http::incoming::Request IncomingRequest Convenience typedef for oatpp::web::protocol::http::incoming::Request.
oatpp::web::protocol::http::outgoing::Request OutgoingRequest Convenience typedef for oatpp::web::protocol::http::outgoing::Request.
oatpp::web::protocol::http::incoming::Response IncomingResponse Convenience typedef for oatpp::web::protocol::http::incoming::Response.
oatpp::web::protocol::http::outgoing::Response OutgoingResponse Convenience typedef for oatpp::web::protocol::http::outgoing::Response.
oatpp::web::protocol::http::Status Status Convenience typedef for oatpp::web::protocol::http::Status.
oatpp::web::protocol::http::Header Header Convenience typedef for oatpp::web::protocol::http::Header.
oatpp::web::protocol::http::QueryParams QueryParams Convenience typedef for oatpp::web::protocol::http::QueryParams.
oatpp::web::server::api::Endpoint Endpoint Convenience typedef for oatpp::web::server::api::Endpoint.
oatpp::collection::LinkedList<std::shared_ptr<Endpoint>> Endpoints Convenience typedef for list of oatpp::web::server::api::Endpoint.
oatpp::web::server::HttpRequestHandler RequestHandler Convenience typedef for oatpp::web::server::HttpRequestHandler.
oatpp::web::server::handler::AuthorizationHandler AuthorizationHandler Convenience typedef for oatpp::web::server::handler::AuthorizationHandler.
oatpp::data::mapping::ObjectMapper ObjectMapper Convenience typedef for oatpp::data::mapping::ObjectMapper.
oatpp::String String Convenience typedef for oatpp::data::mapping::type::String.
oatpp::Int8 Int8 Convenience typedef for oatpp::data::mapping::type::Int8.
oatpp::UInt8 UInt8 Convenience typedef for oatpp::data::mapping::type::UInt8.
oatpp::Int16 Int16 Convenience typedef for oatpp::data::mapping::type::Int16.
oatpp::UInt16 UInt16 Convenience typedef for oatpp::data::mapping::type::UInt16.
oatpp::Int32 Int32 Convenience typedef for oatpp::data::mapping::type::Int32.
oatpp::UInt32 UInt32 Convenience typedef for oatpp::data::mapping::type::UInt32.
oatpp::Int64 Int64 Convenience typedef for oatpp::data::mapping::type::Int64.
oatpp::UInt64 UInt64 Convenience typedef for oatpp::data::mapping::type::UInt64.
oatpp::Float32 Float32 Convenience typedef for oatpp::data::mapping::type::Float32.
oatpp::Float64 Float64 Convenience typedef for atpp::data::mapping::type::Float64.
oatpp::Boolean Boolean Convenience typedef for oatpp::data::mapping::type::Boolean.

# Methods

Return Type Name Summary
void addEndpointsToRouter Subscribes all created endpoint-handlers to corresponding URLs in Router
std::shared_ptr<Endpoints> getEndpoints Get list of Endpoints created via ENDPOINT macro
void setErrorHandler [under discussion]
std::shared_ptr<OutgoingResponse> handleError [under discussion]
void setDefaultAuthorizationHandler [under discussion]
std::shared_ptr<handler::AuthorizationHandler> getDefaultAuthorizationHandler Get authorization handler.
std::shared_ptr<handler::AuthorizationObject> handleDefaultAuthorization [under discussion]

# ApiController::Router

Convenience typedef for oatpp::web::server::HttpRouter.

typedef oatpp::web::server::HttpRouter Router

# ApiController::ResponseFactory

Convenience typedef for oatpp::web::protocol::http::outgoing::ResponseFactory.

typedef oatpp::web::protocol::http::outgoing::ResponseFactory ResponseFactory

# ApiController::IncomingRequest

Convenience typedef for oatpp::web::protocol::http::incoming::Request.

typedef oatpp::web::protocol::http::incoming::Request IncomingRequest

# ApiController::OutgoingRequest

Convenience typedef for oatpp::web::protocol::http::outgoing::Request.

typedef oatpp::web::protocol::http::outgoing::Request OutgoingRequest

# ApiController::IncomingResponse

Convenience typedef for oatpp::web::protocol::http::incoming::Response.

typedef oatpp::web::protocol::http::incoming::Response IncomingResponse

# ApiController::OutgoingResponse

Convenience typedef for oatpp::web::protocol::http::outgoing::Response.

typedef oatpp::web::protocol::http::outgoing::Response OutgoingResponse

# ApiController::Status

Convenience typedef for oatpp::web::protocol::http::Status.

typedef oatpp::web::protocol::http::Status Status

# ApiController::Header

Convenience typedef for oatpp::web::protocol::http::Header.

typedef oatpp::web::protocol::http::Header Header

# ApiController::QueryParams

Convenience typedef for oatpp::web::protocol::http::QueryParams.

typedef oatpp::web::protocol::http::QueryParams QueryParams

# ApiController::Endpoint

Convenience typedef for oatpp::web::server::api::Endpoint.

typedef oatpp::web::server::api::Endpoint Endpoint

# ApiController::Endpoints

Convenience typedef for list of oatpp::web::server::api::Endpoint.

typedef oatpp::collection::LinkedList<std::shared_ptr<Endpoint>> Endpoints

# ApiController::RequestHandler

Convenience typedef for oatpp::web::server::HttpRequestHandler.

typedef oatpp::web::server::HttpRequestHandler RequestHandler

# ApiController::AuthorizationHandler

Convenience typedef for oatpp::web::server::handler::AuthorizationHandler.

typedef oatpp::web::server::handler::AuthorizationHandler AuthorizationHandler

# ApiController::ObjectMapper

Convenience typedef for oatpp::data::mapping::ObjectMapper.

typedef oatpp::data::mapping::ObjectMapper ObjectMapper

# ApiController::String

Convenience typedef for oatpp::data::mapping::type::String.

typedef oatpp::String String

# ApiController::Int8

Convenience typedef for oatpp::data::mapping::type::Int8.

typedef oatpp::Int8 Int8

# ApiController::UInt8

Convenience typedef for oatpp::data::mapping::type::UInt8.

typedef oatpp::UInt8 UInt8

# ApiController::Int16

Convenience typedef for oatpp::data::mapping::type::Int16.

typedef oatpp::Int16 Int16

# ApiController::UInt16

Convenience typedef for oatpp::data::mapping::type::UInt16.

typedef oatpp::UInt16 UInt16

# ApiController::Int32

Convenience typedef for oatpp::data::mapping::type::Int32.

typedef oatpp::Int32 Int32

# ApiController::UInt32

Convenience typedef for oatpp::data::mapping::type::UInt32.

typedef oatpp::UInt32 UInt32

# ApiController::Int64

Convenience typedef for oatpp::data::mapping::type::Int64.

typedef oatpp::Int64 Int64

# ApiController::UInt64

Convenience typedef for oatpp::data::mapping::type::UInt64.

typedef oatpp::UInt64 UInt64

# ApiController::Float32

Convenience typedef for oatpp::data::mapping::type::Float32.

typedef oatpp::Float32 Float32

# ApiController::Float64

Convenience typedef for atpp::data::mapping::type::Float64.

typedef oatpp::Float64 Float64

# ApiController::Boolean

Convenience typedef for oatpp::data::mapping::type::Boolean.

typedef oatpp::Boolean Boolean

# ApiController::addEndpointsToRouter

Subscribes all created endpoint-handlers to corresponding URLs in Router

void addEndpointsToRouter(const std::shared_ptr<Router>& router)

# ApiController::getEndpoints

Get list of Endpoints created via ENDPOINT macro

std::shared_ptr<Endpoints> getEndpoints()

# ApiController::setErrorHandler

[under discussion] Set error handler to handle calls to handleError

void setErrorHandler(const std::shared_ptr<handler::ErrorHandler>& errorHandler)

# ApiController::handleError

[under discussion] Do not use it directly. This method is under discussion. Currently returns Response created by registered ErrorHandler or returns Response created by DefaultErrorHandler::handleDefaultError Notice: Does not throw the Error anymore, error-response has to be returned by the caller!

std::shared_ptr<OutgoingResponse> handleError(const Status& status, const oatpp::String& message) const

# ApiController::setDefaultAuthorizationHandler

[under discussion] Set authorization handler to handle calls to handleAuthorization. Must be called before controller is added to a router or swagger-doc if an endpoint uses the AUTHORIZATION macro

void setDefaultAuthorizationHandler(const std::shared_ptr<handler::AuthorizationHandler>& authorizationHandler)

# ApiController::getDefaultAuthorizationHandler

Get authorization handler.

  • @return

std::shared_ptr<handler::AuthorizationHandler> getDefaultAuthorizationHandler()

# ApiController::handleDefaultAuthorization

[under discussion] Do not use it directly. This method is under discussion. Currently returns AuthorizationObject created by AuthorizationHandler or return DefaultAuthorizationObject by DefaultAuthorizationHandler if AuthorizationHandler is null

std::shared_ptr<handler::AuthorizationObject> handleDefaultAuthorization(const String &authHeader) const